mumukit-auth 3.1.0 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mumukit/auth/grant.rb +12 -0
- data/lib/mumukit/auth/permissions.rb +12 -3
- data/lib/mumukit/auth/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f582e482347dc9147657752b0307c6756d81b627
|
4
|
+
data.tar.gz: 9a783d130d27f08a61fec39d6a34348c8355fb48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7154ba40df463d0110b76c96d04cc335dc421db62e310b5788d78bd9712536b4606baeac7e4c1f75040ea600f8434152f4662f314636f72851eddc578b0a5cbb
|
7
|
+
data.tar.gz: 9faa565b72369ff5213f3bd440b8c4f62726fdca9cddd423f33a513c335ad7c4e334d4be89783df03b18fe428bd160c9fd76973746ea6622c93103c2801bdaf4
|
data/lib/mumukit/auth/grant.rb
CHANGED
@@ -39,6 +39,10 @@ module Mumukit::Auth
|
|
39
39
|
def to_s
|
40
40
|
'*'
|
41
41
|
end
|
42
|
+
|
43
|
+
def to_mumukit_slug
|
44
|
+
Mumukit::Auth::Slug.new '*', '*'
|
45
|
+
end
|
42
46
|
end
|
43
47
|
|
44
48
|
class FirstPartGrant < Grant
|
@@ -53,6 +57,10 @@ module Mumukit::Auth
|
|
53
57
|
def to_s
|
54
58
|
"#{@first}/*"
|
55
59
|
end
|
60
|
+
|
61
|
+
def to_mumukit_slug
|
62
|
+
Mumukit::Auth::Slug.new @first, '*'
|
63
|
+
end
|
56
64
|
end
|
57
65
|
|
58
66
|
class SingleGrant < Grant
|
@@ -68,5 +76,9 @@ module Mumukit::Auth
|
|
68
76
|
def to_s
|
69
77
|
@slug.to_s
|
70
78
|
end
|
79
|
+
|
80
|
+
def to_mumukit_slug
|
81
|
+
@slug
|
82
|
+
end
|
71
83
|
end
|
72
84
|
end
|
@@ -25,7 +25,6 @@ class Mumukit::Auth::Permissions
|
|
25
25
|
scopes[role].present?
|
26
26
|
end
|
27
27
|
|
28
|
-
|
29
28
|
def scope_for(role)
|
30
29
|
self.scopes[role] ||= Mumukit::Auth::Scope.new
|
31
30
|
end
|
@@ -43,6 +42,10 @@ class Mumukit::Auth::Permissions
|
|
43
42
|
add_permission! role, new_grant
|
44
43
|
end
|
45
44
|
|
45
|
+
def delegate_to?(other)
|
46
|
+
other.scopes.all? { |role, scope| has_all_permissions?(role, scope) }
|
47
|
+
end
|
48
|
+
|
46
49
|
def as_json(options={})
|
47
50
|
scopes.as_json(options)
|
48
51
|
end
|
@@ -59,8 +62,14 @@ class Mumukit::Auth::Permissions
|
|
59
62
|
end
|
60
63
|
end
|
61
64
|
|
62
|
-
def self.dump(
|
63
|
-
|
65
|
+
def self.dump(permission)
|
66
|
+
permission.to_json
|
67
|
+
end
|
68
|
+
|
69
|
+
private
|
70
|
+
|
71
|
+
def has_all_permissions?(role, scope)
|
72
|
+
scope.grants.all? { |grant| has_permission? role, grant }
|
64
73
|
end
|
65
74
|
|
66
75
|
end
|
data/lib/mumukit/auth/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mumukit-auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Franco Leonardo Bulgarelli
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|