lmcadm 0.5.0 → 0.6.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/exe/lmcadm +1 -1
- data/lib/lmcadm/account_commands.rb +52 -3
- data/lib/lmcadm/commands/rights.rb +31 -0
- data/lib/lmcadm/version.rb +1 -1
- data/lmcadm.gemspec +1 -2
- metadata +5 -5
- data/.idea/lmcadm.iml +0 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4662ef1eaa3af21b5618670a9a5ccc8eeb29d3f0
|
4
|
+
data.tar.gz: 9ee1929880d8fd6a5b200054919267a78b7b94c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50144f9e135a7038e1aae7161872840c2aa2a2ece6529c2bb8a6069272d64614f9b0e25299aca8ff5b703dd3bee3790c068c8d5d44765da5e89269003245f84d
|
7
|
+
data.tar.gz: 172fe4b06a8f7b5b9e1ec9f2bbdc7a85e77568bf661a8be902987df94d11b8b34e0fd5e92c1f96d94658f675557e6df5b4d96d21046e61773448b347fd8838a5
|
data/exe/lmcadm
CHANGED
@@ -159,7 +159,12 @@ module LMCAdm
|
|
159
159
|
memberlist.action do |global_options, options, args|
|
160
160
|
account = LMC::Account.get_by_uuid_or_name args.first
|
161
161
|
members = account.members
|
162
|
-
tp members, [{:id => {:width => 36}}, :name, :type, :state, :invitationState, :principalState,
|
162
|
+
tp members, [{:id => {:width => 36}}, :name, :type, :state, :invitationState, :principalState,
|
163
|
+
:authorities => lambda {|m|
|
164
|
+
m.authorities.map {|a|
|
165
|
+
a['name']
|
166
|
+
}.join(',')
|
167
|
+
}]
|
163
168
|
end
|
164
169
|
end
|
165
170
|
|
@@ -270,12 +275,24 @@ module LMCAdm
|
|
270
275
|
auth.action do |g, o, args|
|
271
276
|
account = LMC::Account.get_by_uuid_or_name args.first
|
272
277
|
authorities = account.authorities
|
273
|
-
puts authorities.first.inspect
|
274
278
|
max = Helpers::longest_in_collection(authorities.map {|a| a.name})
|
275
279
|
puts max
|
276
280
|
tp authorities, [{:id => {:width => 36}}, {:name => {:width => max}}, :visibility, :type]
|
277
281
|
end
|
278
282
|
end
|
283
|
+
c.desc 'Manage authorities'
|
284
|
+
c.command :authority do |auth|
|
285
|
+
auth.arg_name 'Authority name', [:required]
|
286
|
+
auth.command :create do |create|
|
287
|
+
create.desc 'Account name|UUID'
|
288
|
+
create.flag :A, :required => true
|
289
|
+
create.action do |_global_options, options, _args|
|
290
|
+
account = LMC::Account.get_by_uuid_or_name options[:A]
|
291
|
+
auth = LMC::Authority.new({'name' => _args.first, 'visibility' => 'PRIVATE'}, account)
|
292
|
+
puts auth.save
|
293
|
+
end
|
294
|
+
end
|
295
|
+
end
|
279
296
|
|
280
297
|
c.arg_name "email address", [:multiple]
|
281
298
|
c.desc 'Invite members, requires an account type'
|
@@ -288,7 +305,7 @@ module LMCAdm
|
|
288
305
|
cloud = LMC::Cloud.instance
|
289
306
|
chosen_authorities = account.authorities.select {|auth| auth.name == options[:role]}
|
290
307
|
args.each do |email|
|
291
|
-
|
308
|
+
cloud.invite_user_to_account email, account.id, options[:type], chosen_authorities
|
292
309
|
end
|
293
310
|
end
|
294
311
|
|
@@ -336,6 +353,37 @@ module LMCAdm
|
|
336
353
|
end
|
337
354
|
end
|
338
355
|
|
356
|
+
c.arg_name 'member name', [:required]
|
357
|
+
c.desc 'Update membership'
|
358
|
+
c.command :memberupdate do |update|
|
359
|
+
update.flag :A, :account, :required => true
|
360
|
+
update.desc 'authority id'
|
361
|
+
update.flag 'add-authority'
|
362
|
+
update.action do |global_options, options, args|
|
363
|
+
account = LMC::Account.get_by_uuid_or_name(options[:account])
|
364
|
+
membership = account.find_member_by_name args.first
|
365
|
+
puts membership
|
366
|
+
if options['add-authority']
|
367
|
+
# new_authority = account.authorities.find do |a|
|
368
|
+
# a.name == options['add-authority']
|
369
|
+
# end
|
370
|
+
puts membership.class
|
371
|
+
puts membership.authorities.class
|
372
|
+
authority_ids = membership.authorities.map do |a|
|
373
|
+
a['id']
|
374
|
+
end
|
375
|
+
puts authority_ids
|
376
|
+
authority_ids = authority_ids.concat [options['add-authority']]
|
377
|
+
puts authority_ids
|
378
|
+
# POST /accounts/{accountId}/members/{principalId}
|
379
|
+
cloud = LMC::Cloud.instance
|
380
|
+
cloud.auth_for_account account
|
381
|
+
res = cloud.post ['cloud-service-auth', 'accounts', account.id, 'members', membership.id], {'authorities' => authority_ids}
|
382
|
+
puts res
|
383
|
+
end
|
384
|
+
end
|
385
|
+
end
|
386
|
+
|
339
387
|
|
340
388
|
# IF the special flag is set, do weird license magic for ninden
|
341
389
|
# * Für alle unterliegenden Organisationen
|
@@ -389,6 +437,7 @@ module LMCAdm
|
|
389
437
|
end
|
390
438
|
end
|
391
439
|
end
|
440
|
+
|
392
441
|
recurse_childen account, 0
|
393
442
|
end
|
394
443
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module LMCAdm
|
2
|
+
command :rights do |rights|
|
3
|
+
rights.command :list do |list|
|
4
|
+
list.action do |options, global_options, args|
|
5
|
+
c = LMC::Cloud.instance
|
6
|
+
LMC::SERVICELIST.each do |service|
|
7
|
+
puts service
|
8
|
+
begin
|
9
|
+
puts "#{c.get([service, "rights", "public"]).body}\n\n"
|
10
|
+
rescue RestClient::Exception =>e
|
11
|
+
puts e.response
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
rights.arg_name "rights"
|
17
|
+
rights.command :assign do |assign|
|
18
|
+
assign.flag :A
|
19
|
+
assign.flag :authority
|
20
|
+
assign.flag :service
|
21
|
+
assign.action do |_g, o, a |
|
22
|
+
#POST /accounts/{accountId}/authorities/{authorityId}/rights
|
23
|
+
account = LMC::Account.get_by_uuid_or_name o[:A]
|
24
|
+
c = LMC::Cloud.instance
|
25
|
+
c.auth_for_account account
|
26
|
+
c.post [o[:service], "accounts", account.id, 'authorities', o[:authority], 'rights' ], a
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/lmcadm/version.rb
CHANGED
data/lmcadm.gemspec
CHANGED
@@ -15,7 +15,6 @@ Gem::Specification.new do |spec|
|
|
15
15
|
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
16
16
|
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
17
17
|
if spec.respond_to?(:metadata)
|
18
|
-
#spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
19
18
|
else
|
20
19
|
raise "RubyGems 2.0 or newer is required to protect against " \
|
21
20
|
"public gem pushes."
|
@@ -33,7 +32,7 @@ Gem::Specification.new do |spec|
|
|
33
32
|
spec.add_development_dependency "minitest", "~> 5.0"
|
34
33
|
spec.add_development_dependency "pry-nav", "0.2.4"
|
35
34
|
|
36
|
-
spec.add_runtime_dependency 'lmc', '~> 0.
|
35
|
+
spec.add_runtime_dependency 'lmc', '~> 0.5.0'
|
37
36
|
spec.add_runtime_dependency 'gli', '~> 2.17'
|
38
37
|
spec.add_runtime_dependency 'table_print', '~> 1.5'
|
39
38
|
spec.add_runtime_dependency 'colorize'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lmcadm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- erpel
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-07-
|
11
|
+
date: 2018-07-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.
|
75
|
+
version: 0.5.0
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.
|
82
|
+
version: 0.5.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: gli
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -131,7 +131,6 @@ extensions: []
|
|
131
131
|
extra_rdoc_files: []
|
132
132
|
files:
|
133
133
|
- ".gitignore"
|
134
|
-
- ".idea/lmcadm.iml"
|
135
134
|
- ".idea/misc.xml"
|
136
135
|
- ".idea/modules.xml"
|
137
136
|
- ".idea/vcs.xml"
|
@@ -155,6 +154,7 @@ files:
|
|
155
154
|
- lib/lmcadm/commands/maintenance.rb
|
156
155
|
- lib/lmcadm/commands/principal.rb
|
157
156
|
- lib/lmcadm/commands/privatecloud.rb
|
157
|
+
- lib/lmcadm/commands/rights.rb
|
158
158
|
- lib/lmcadm/config_commands.rb
|
159
159
|
- lib/lmcadm/device_commands.rb
|
160
160
|
- lib/lmcadm/helpers/password_helper.rb
|
data/.idea/lmcadm.iml
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<module type="RUBY_MODULE" version="4">
|
3
|
-
<component name="ModuleRunConfigurationManager">
|
4
|
-
<shared />
|
5
|
-
</component>
|
6
|
-
<component name="NewModuleRootManager">
|
7
|
-
<content url="file://$MODULE_DIR$" />
|
8
|
-
<orderEntry type="jdk" jdkName="rbenv: 2.4.1" jdkType="RUBY_SDK" />
|
9
|
-
<orderEntry type="sourceFolder" forTests="false" />
|
10
|
-
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.16.1, rbenv: 2.4.1) [gem]" level="application" />
|
11
|
-
<orderEntry type="library" scope="PROVIDED" name="colorize (v0.8.1, rbenv: 2.4.1) [gem]" level="application" />
|
12
|
-
<orderEntry type="library" scope="PROVIDED" name="domain_name (v0.5.20170404, rbenv: 2.4.1) [gem]" level="application" />
|
13
|
-
<orderEntry type="library" scope="PROVIDED" name="gli (v2.17.1, rbenv: 2.4.1) [gem]" level="application" />
|
14
|
-
<orderEntry type="library" scope="PROVIDED" name="http-cookie (v1.0.3, rbenv: 2.4.1) [gem]" level="application" />
|
15
|
-
<orderEntry type="library" scope="PROVIDED" name="json (v2.1.0, rbenv: 2.4.1) [gem]" level="application" />
|
16
|
-
<orderEntry type="library" scope="PROVIDED" name="lmc (v0.2.0, rbenv: 2.4.1) [gem]" level="application" />
|
17
|
-
<orderEntry type="library" scope="PROVIDED" name="mime-types (v3.1, rbenv: 2.4.1) [gem]" level="application" />
|
18
|
-
<orderEntry type="library" scope="PROVIDED" name="mime-types-data (v3.2016.0521, rbenv: 2.4.1) [gem]" level="application" />
|
19
|
-
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.11.3, rbenv: 2.4.1) [gem]" level="application" />
|
20
|
-
<orderEntry type="library" scope="PROVIDED" name="netrc (v0.11.0, rbenv: 2.4.1) [gem]" level="application" />
|
21
|
-
<orderEntry type="library" scope="PROVIDED" name="rake (v10.5.0, rbenv: 2.4.1) [gem]" level="application" />
|
22
|
-
<orderEntry type="library" scope="PROVIDED" name="rest-client (v2.0.2, rbenv: 2.4.1) [gem]" level="application" />
|
23
|
-
<orderEntry type="library" scope="PROVIDED" name="table_print (v1.5.6, rbenv: 2.4.1) [gem]" level="application" />
|
24
|
-
<orderEntry type="library" scope="PROVIDED" name="unf (v0.1.4, rbenv: 2.4.1) [gem]" level="application" />
|
25
|
-
<orderEntry type="library" scope="PROVIDED" name="unf_ext (v0.0.7.5, rbenv: 2.4.1) [gem]" level="application" />
|
26
|
-
</component>
|
27
|
-
</module>
|