mumukit-auth 7.7.0 → 7.11.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 +2 -0
- data/lib/mumukit/auth/permissions.rb +9 -1
- data/lib/mumukit/auth/role.rb +6 -0
- data/lib/mumukit/auth/roles.rb +1 -1
- data/lib/mumukit/auth/version.rb +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 77c87545b48934c4545514e7596756d0e9bdd91837c8dc671f9e8a8fd6262752
|
4
|
+
data.tar.gz: dbb8db587aa6eb02dd0baa708cfd65096315faa191ff47b057c65ec35cc50cd3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 870916a0477ad23ebd5ae68ed5649f91de95e710309cc846509a74541bdebce734ec715c87c1d016944d5b0772e826031a41d4673465ef6752d38a8358b688ad
|
7
|
+
data.tar.gz: '019eacadcfe2f1c978e4d208048fa74b48a7663dd05e85ea6046b2f25f0a6b11a53562f4af0b24f0098d0398b5700be6e18d7931cc0729cca27b0292c732145c'
|
data/lib/mumukit/auth/grant.rb
CHANGED
@@ -41,8 +41,16 @@ class Mumukit::Auth::Permissions
|
|
41
41
|
granted_organizations_for :student
|
42
42
|
end
|
43
43
|
|
44
|
+
def any_granted_organizations
|
45
|
+
scopes.values.flat_map(&:grants).map(&:organization).to_set
|
46
|
+
end
|
47
|
+
|
48
|
+
def any_granted_roles
|
49
|
+
scopes.select { |_, scope| scope.present? }.keys.to_set
|
50
|
+
end
|
51
|
+
|
44
52
|
def granted_organizations_for(role)
|
45
|
-
scope_for(role)&.grants&.map
|
53
|
+
scope_for(role)&.grants&.map(&:organization).to_set
|
46
54
|
end
|
47
55
|
|
48
56
|
def add_permission!(role, *grants)
|
data/lib/mumukit/auth/role.rb
CHANGED
@@ -28,6 +28,9 @@ module Mumukit::Auth
|
|
28
28
|
@roles[role] ||= "Mumukit::Auth::Role::#{role.to_s.camelize}".constantize.new(role.to_sym)
|
29
29
|
end
|
30
30
|
|
31
|
+
class ExStudent < Role
|
32
|
+
parent :student
|
33
|
+
end
|
31
34
|
class Student < Role
|
32
35
|
parent :teacher
|
33
36
|
end
|
@@ -47,6 +50,9 @@ module Mumukit::Auth
|
|
47
50
|
parent :admin
|
48
51
|
end
|
49
52
|
class Moderator < Role
|
53
|
+
parent :forum_supervisor
|
54
|
+
end
|
55
|
+
class ForumSupervisor < Role
|
50
56
|
parent :admin
|
51
57
|
end
|
52
58
|
class Admin < Role
|
data/lib/mumukit/auth/roles.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Mumukit::Auth
|
2
2
|
module Roles
|
3
|
-
ROLES = [:student, :teacher, :headmaster, :writer, :editor, :janitor, :moderator, :admin, :owner]
|
3
|
+
ROLES = [:ex_student, :student, :teacher, :headmaster, :writer, :editor, :janitor, :moderator, :forum_supervisor, :admin, :owner]
|
4
4
|
|
5
5
|
ROLES.each do |role|
|
6
6
|
define_method "#{role}?" do |scope = Mumukit::Auth::Slug.any|
|
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: 7.
|
4
|
+
version: 7.11.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:
|
11
|
+
date: 2021-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,42 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.0'
|
20
20
|
type: :development
|
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: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '12.3'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '12.3'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '3.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '3.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: jwt
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -119,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
119
|
- !ruby/object:Gem::Version
|
120
120
|
version: '0'
|
121
121
|
requirements: []
|
122
|
-
rubygems_version: 3.0.
|
122
|
+
rubygems_version: 3.0.3
|
123
123
|
signing_key:
|
124
124
|
specification_version: 4
|
125
125
|
summary: Library for authorizing mumuki requests
|