kaname 0.5.2 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bfebd9bb80d51a53c5a41afa453e0288fa8ed664
4
- data.tar.gz: 1259abbf32f2b632cb94914e349c2ceb4fc59131
3
+ metadata.gz: 4d343b35548ff490c4cf6c6d66f48bf895d5655b
4
+ data.tar.gz: 109027072e13cb3d96ecee4bf32c652314e31c5a
5
5
  SHA512:
6
- metadata.gz: b43a0ac06ebe402266865f0bf4e147a4b911b3c5d1bf5dda01ea03d45d659065453204ef8f877338d09eb30e1baccbb1e43ba6cb9dca2e3e79af1694bc62d984
7
- data.tar.gz: f760c17207e6bb2f75c9603b83cf3837779e57b545f1067f834214eaf246e63b5e93965a1fb50f9b77fd03889a7fb3f5e2cb066adc26154eaa62b95c0205715e
6
+ metadata.gz: cfd3964b238935cb1f23967b8185640bdeda8f0b5ffe1c201d54f5ae461a246d7389470109be220ec95e3ad5a18c79600740458394f662d38141ef8345ac7069
7
+ data.tar.gz: 594a5f5eb3d613e268260ffa2816dae8e73410e1316b22fb9fc151ff140bfd1090a691cd70dba73c13b83d9b09017795d48e7d3bce970655fdc16fa312c45254
@@ -22,11 +22,19 @@ module Kaname
22
22
  @_roles ||= Yao::Role.list
23
23
  end
24
24
 
25
+ def list_role_assignments
26
+ unless @_role_assignments
27
+ @_role_assignments ||= Yao::RoleAssignment.list
28
+ Yao::Auth.try_new
29
+ end
30
+ @_role_assignments
31
+ end
32
+
25
33
  def users_hash
26
34
  @_user_hash ||= list_users.each_with_object(Hash.new { |h,k| h[k] = {} }) do |u,uh|
27
35
  next if ignored_users.include?(u.name)
28
36
  uh[u.name]["email"] = u.email
29
- uh[u.name]["tenants"] = tenant_role_hash(u.name)
37
+ uh[u.name]["tenants"] = tenant_role_hash(u.id)
30
38
  end
31
39
  end
32
40
 
@@ -54,10 +62,11 @@ module Kaname
54
62
 
55
63
  private
56
64
 
57
- def tenant_role_hash(user_name)
58
- list_tenants.each_with_object(Hash.new) do |t,th|
59
- r = Yao::Role.list_for_user(user_name, on: t.name)
60
- th[t.name] = r.first.name if r.size > 0
65
+ def tenant_role_hash(user_id)
66
+ list_role_assignments.each_with_object(Hash.new) do |t,th|
67
+ if t.user.id == user_id
68
+ th[list_tenants.find {|ts| ts.id == t.scope["project"]["id"]}["name"]] = list_roles.find {|r| r.id == t.role.id }['name']
69
+ end
61
70
  end
62
71
  end
63
72
 
@@ -1,3 +1,3 @@
1
1
  module Kaname
2
- VERSION = "0.5.2"
2
+ VERSION = "0.6.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kaname
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - SHIBATA Hiroshi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-05-12 00:00:00.000000000 Z
11
+ date: 2017-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: yao