Module: Artifactory::Permissions
- Defined in:
- lib/artifactory/permissions.rb,
lib/artifactory/permissions/v2.rb,
lib/artifactory/permissions/errors.rb,
lib/artifactory/permissions/helpers.rb,
lib/artifactory/permissions/version.rb,
lib/artifactory/permissions/v2/commands.rb,
lib/artifactory/permissions/v2/api_client.rb,
lib/artifactory/permissions/v2/permission_items.rb,
lib/artifactory/permissions/v2/permission_target.rb,
lib/artifactory/permissions/v2/commands/delete_item.rb,
lib/artifactory/permissions/v2/commands/upsert_item.rb,
lib/artifactory/permissions/v2/permission_items/base.rb,
lib/artifactory/permissions/v2/permission_items/user.rb,
lib/artifactory/permissions/v2/permission_items/group.rb,
lib/artifactory/permissions/v2/commands/save_permission.rb,
lib/artifactory/permissions/v2/commands/permission_item_command.rb
Defined Under Namespace
Modules: Helpers, V2
Classes: Errors
Constant Summary
collapse
- Error =
Class.new StandardError
- FatalError =
Class.new Error
- PERMISSIONS =
%w[read write annotate delete manage managedXrayMeta distribute].freeze
- SCOPES =
%w[repo build releaseBundle].freeze
- VERSION =
"0.1.0"
Class Method Summary
collapse
-
.api_client(endpoint:, api_key:) ⇒ Object
-
.delete_group(permission_target:, group:) ⇒ Object
-
.delete_user(permission_target:, user:) ⇒ Object
-
.find(name:, api_client:) ⇒ Object
-
.get(uri, api_client:) ⇒ Object
-
.group(name:, permissions:, scope:) ⇒ Object
-
.list(api_client:) ⇒ Object
-
.save(permission_target:, api_client:) ⇒ Object
-
.upsert_group(permission_target:, group:) ⇒ Object
-
.upsert_user(permission_target:, user:) ⇒ Object
-
.user(name:, permissions:, scope:) ⇒ Object
Class Method Details
.api_client(endpoint:, api_key:) ⇒ Object
79
80
81
82
|
# File 'lib/artifactory/permissions.rb', line 79
def api_client(endpoint:, api_key:)
V2.api_client endpoint: endpoint,
api_key: api_key
end
|
.delete_group(permission_target:, group:) ⇒ Object
65
66
67
68
69
70
|
# File 'lib/artifactory/permissions.rb', line 65
def delete_group(permission_target:, group:)
V2::Commands.delete_item permission_target: permission_target,
item: group
[group.errors? ? :error : :ok, permission_target, group.errors]
end
|
.delete_user(permission_target:, user:) ⇒ Object
51
52
53
54
55
56
|
# File 'lib/artifactory/permissions.rb', line 51
def delete_user(permission_target:, user:)
V2::Commands.delete_item permission_target: permission_target,
item: user
[user.errors? ? :error : :ok, permission_target, user.errors]
end
|
.find(name:, api_client:) ⇒ Object
20
21
22
23
24
|
# File 'lib/artifactory/permissions.rb', line 20
def find(name:, api_client:)
status, result = api_client.find_permission name: name
status == :ok ? [:ok, V2.parse_permission_target(result)] : [status, result]
end
|
.get(uri, api_client:) ⇒ Object
26
27
28
29
30
|
# File 'lib/artifactory/permissions.rb', line 26
def get(uri, api_client:)
status, result = api_client.get uri
status == :ok ? [:ok, V2.parse_permission_target(result)] : [status, result]
end
|
.group(name:, permissions:, scope:) ⇒ Object
38
39
40
41
42
|
# File 'lib/artifactory/permissions.rb', line 38
def group(name:, permissions:, scope:)
V2::PermissionItems.group name: name,
permissions: permissions,
scope: scope
end
|
.list(api_client:) ⇒ Object
16
17
18
|
# File 'lib/artifactory/permissions.rb', line 16
def list(api_client:)
api_client.list_permissions
end
|
.save(permission_target:, api_client:) ⇒ Object
72
73
74
75
76
77
|
# File 'lib/artifactory/permissions.rb', line 72
def save(permission_target:, api_client:)
V2::Commands.save_permission_target permission_target: permission_target,
api_client: api_client
[permission_target.errors? ? :error : :ok, permission_target, permission_target.errors]
end
|
.upsert_group(permission_target:, group:) ⇒ Object
58
59
60
61
62
63
|
# File 'lib/artifactory/permissions.rb', line 58
def upsert_group(permission_target:, group:)
V2::Commands.upsert_item permission_target: permission_target,
item: group
[group.errors? ? :error : :ok, permission_target, group.errors]
end
|
.upsert_user(permission_target:, user:) ⇒ Object
44
45
46
47
48
49
|
# File 'lib/artifactory/permissions.rb', line 44
def upsert_user(permission_target:, user:)
V2::Commands.upsert_item permission_target: permission_target,
item: user
[user.errors? ? :error : :ok, permission_target, user.errors]
end
|
.user(name:, permissions:, scope:) ⇒ Object
32
33
34
35
36
|
# File 'lib/artifactory/permissions.rb', line 32
def user(name:, permissions:, scope:)
V2::PermissionItems.user name: name,
permissions: permissions,
scope: scope
end
|