artifactory-permissions 0.1.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +4 -4
- data/README.md +3 -3
- data/artifactory-permissions.gemspec +2 -2
- data/lib/artifactory/permissions/errors.rb +7 -5
- data/lib/artifactory/permissions/v2/api_client.rb +6 -6
- data/lib/artifactory/permissions/v2.rb +3 -3
- data/lib/artifactory/permissions/version.rb +1 -1
- data/lib/artifactory/permissions.rb +2 -2
- metadata +6 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8bf020b2ec9adf639c3b7f002b13e944a2c43ac9ad0da32419378e407d17e55b
|
|
4
|
+
data.tar.gz: 1dc6e70c69e7588fdaf0e1ae3c905d8f19a5d5a395311131a080faf02155144d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1cac073029443d01e0c24ef068ea545e180df1487d855e30eff881b39bc899a9776690f615b6c0a10905f2e0bae1e5d2d353227604deb25abd6be5b1fe6cba68
|
|
7
|
+
data.tar.gz: 80849b609522af18b3a47ea60b0460468f80eb525c514b596b0522e2bde0f6525774fb5e1d72b317c99a734cc1f7df02b5f68a60ac36e9c1adfd8d8f3bf1d81d
|
data/Gemfile
CHANGED
|
@@ -3,7 +3,7 @@ source "https://rubygems.org"
|
|
|
3
3
|
# Specify your gem's dependencies in artifactory-permissions.gemspec
|
|
4
4
|
gemspec
|
|
5
5
|
|
|
6
|
-
gem "rake", "~> 12.
|
|
7
|
-
gem "rspec", "~> 3.
|
|
8
|
-
gem "webmock", "~> 3.
|
|
9
|
-
gem "byebug", "~>
|
|
6
|
+
gem "rake", "~> 12.3"
|
|
7
|
+
gem "rspec", "~> 3.13"
|
|
8
|
+
gem "webmock", "~> 3.25"
|
|
9
|
+
gem "byebug", "~> 12.0"
|
data/README.md
CHANGED
|
@@ -27,7 +27,7 @@ Or install it yourself as:
|
|
|
27
27
|
### List permission targets accessible to your user
|
|
28
28
|
```ruby
|
|
29
29
|
api_client = Artifactory::Permissions.api_client endpoint: 'http://artifactory.local',
|
|
30
|
-
|
|
30
|
+
access_token: 'your-access-token'
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
Artifactory::Permissions.list api_client: api_client
|
|
@@ -37,7 +37,7 @@ Artifactory::Permissions.list api_client: api_client
|
|
|
37
37
|
### Show / find / get permission target
|
|
38
38
|
```ruby
|
|
39
39
|
api_client = Artifactory::Permissions.api_client endpoint: 'http://artifactory.local',
|
|
40
|
-
|
|
40
|
+
access_token: 'your-access-token'
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
_status, permission_target = Artifactory::Permissions.find name: "<pt-name>",
|
|
@@ -52,7 +52,7 @@ _status, permission_target = Artifactory::Permissions.get "<permission-target-re
|
|
|
52
52
|
### Add / update / delete users and groups
|
|
53
53
|
```ruby
|
|
54
54
|
api_client = Artifactory::Permissions.api_client endpoint: 'http://artifactory.local',
|
|
55
|
-
|
|
55
|
+
access_token: 'your-access-token'
|
|
56
56
|
|
|
57
57
|
_status, permission_target = Artifactory::Permissions.find name: "<permission-target-name>",
|
|
58
58
|
api_client: api_client
|
|
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
|
9
9
|
spec.summary = %q{Ruby Lib for managing Artifactory PermissionTargets}
|
|
10
10
|
spec.description = %q{Ruby Lib for managing Artifactory PermissionTargets}
|
|
11
11
|
spec.homepage = "https://github.com/tscholz/artifactory-permissions"
|
|
12
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 2.
|
|
12
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 3.2.0")
|
|
13
13
|
|
|
14
14
|
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
|
15
15
|
|
|
@@ -26,5 +26,5 @@ Gem::Specification.new do |spec|
|
|
|
26
26
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
27
27
|
spec.require_paths = ["lib"]
|
|
28
28
|
|
|
29
|
-
spec.add_dependency "httparty", "~> 0.
|
|
29
|
+
spec.add_dependency "httparty", "~> 0.23.1"
|
|
30
30
|
end
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
module Artifactory
|
|
2
2
|
module Permissions
|
|
3
3
|
class Errors
|
|
4
|
+
attr_reader :errors
|
|
5
|
+
|
|
4
6
|
def initialize
|
|
5
7
|
@errors = Hash.new { |h, k| h[k] = [] }
|
|
6
8
|
end
|
|
7
9
|
|
|
8
10
|
def add(key, msg)
|
|
9
|
-
|
|
11
|
+
errors[key] << msg
|
|
10
12
|
self
|
|
11
13
|
end
|
|
12
14
|
|
|
@@ -17,22 +19,22 @@ module Artifactory
|
|
|
17
19
|
alias_method :none?, :empty?
|
|
18
20
|
|
|
19
21
|
def any?
|
|
20
|
-
|
|
22
|
+
errors.values.flatten.any?
|
|
21
23
|
end
|
|
22
24
|
|
|
23
25
|
def full_messages
|
|
24
|
-
|
|
26
|
+
errors
|
|
25
27
|
.keys
|
|
26
28
|
.map { |key| [key, full_message(key)].join(": ") }
|
|
27
29
|
.join("; ")
|
|
28
30
|
end
|
|
29
31
|
|
|
30
32
|
def full_message(key)
|
|
31
|
-
|
|
33
|
+
errors[key].join(", ")
|
|
32
34
|
end
|
|
33
35
|
|
|
34
36
|
def to_h
|
|
35
|
-
|
|
37
|
+
errors.dup
|
|
36
38
|
end
|
|
37
39
|
end
|
|
38
40
|
end
|
|
@@ -20,11 +20,11 @@ module Artifactory
|
|
|
20
20
|
|
|
21
21
|
HANDLED_ERRORS = [SocketError] + HTTP_ERRORS
|
|
22
22
|
|
|
23
|
-
attr_reader :endpoint, :
|
|
23
|
+
attr_reader :endpoint, :access_token
|
|
24
24
|
|
|
25
|
-
def initialize(endpoint:,
|
|
26
|
-
@endpoint
|
|
27
|
-
@
|
|
25
|
+
def initialize(endpoint:, access_token:)
|
|
26
|
+
@endpoint = endpoint
|
|
27
|
+
@access_token = access_token
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
def list_permissions
|
|
@@ -50,7 +50,7 @@ module Artifactory
|
|
|
50
50
|
|
|
51
51
|
def put(path, data)
|
|
52
52
|
response = self.class.put uri_for(path),
|
|
53
|
-
body:
|
|
53
|
+
body: data.to_json,
|
|
54
54
|
headers: headers
|
|
55
55
|
|
|
56
56
|
handle_response response
|
|
@@ -89,7 +89,7 @@ module Artifactory
|
|
|
89
89
|
end
|
|
90
90
|
|
|
91
91
|
def auth_headers
|
|
92
|
-
{ "
|
|
92
|
+
{ "Authorization" => "Bearer #{access_token}" }
|
|
93
93
|
end
|
|
94
94
|
|
|
95
95
|
def url_safe(string)
|
|
@@ -8,9 +8,9 @@ module Artifactory
|
|
|
8
8
|
module V2
|
|
9
9
|
module_function
|
|
10
10
|
|
|
11
|
-
def api_client(endpoint:,
|
|
12
|
-
ApiClient.new endpoint:
|
|
13
|
-
|
|
11
|
+
def api_client(endpoint:, access_token:)
|
|
12
|
+
ApiClient.new endpoint: endpoint,
|
|
13
|
+
access_token: access_token
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
def parse_permission_target(payload)
|
|
@@ -76,9 +76,9 @@ module Artifactory
|
|
|
76
76
|
[permission_target.errors? ? :error : :ok, permission_target, permission_target.errors]
|
|
77
77
|
end
|
|
78
78
|
|
|
79
|
-
def api_client(endpoint:,
|
|
79
|
+
def api_client(endpoint:, access_token:)
|
|
80
80
|
V2.api_client endpoint: endpoint,
|
|
81
|
-
|
|
81
|
+
access_token: access_token
|
|
82
82
|
end
|
|
83
83
|
end
|
|
84
84
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: artifactory-permissions
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 1.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Thomas Scholz
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2025-07-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: httparty
|
|
@@ -16,14 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version:
|
|
19
|
+
version: 0.23.1
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version:
|
|
26
|
+
version: 0.23.1
|
|
27
27
|
description: Ruby Lib for managing Artifactory PermissionTargets
|
|
28
28
|
email:
|
|
29
29
|
- thomas.scholz@rubyapps.ch
|
|
@@ -72,14 +72,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
72
72
|
requirements:
|
|
73
73
|
- - ">="
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: 2.
|
|
75
|
+
version: 3.2.0
|
|
76
76
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
77
|
requirements:
|
|
78
78
|
- - ">="
|
|
79
79
|
- !ruby/object:Gem::Version
|
|
80
80
|
version: '0'
|
|
81
81
|
requirements: []
|
|
82
|
-
rubygems_version: 3.
|
|
82
|
+
rubygems_version: 3.5.22
|
|
83
83
|
signing_key:
|
|
84
84
|
specification_version: 4
|
|
85
85
|
summary: Ruby Lib for managing Artifactory PermissionTargets
|