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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b28136f7444d373f4ccc47f42df7a2db9f246442b98ccf6dcee5e3810e9ac0d4
4
- data.tar.gz: be139f64aa104e6d4215d7d0eeb9fc5bcebe3dcecbbe55d96206c22129d88c38
3
+ metadata.gz: 77c87545b48934c4545514e7596756d0e9bdd91837c8dc671f9e8a8fd6262752
4
+ data.tar.gz: dbb8db587aa6eb02dd0baa708cfd65096315faa191ff47b057c65ec35cc50cd3
5
5
  SHA512:
6
- metadata.gz: bf861defe02dc8b1ec048e76d209ef5469815eb4b96838b8e7400b40e1cd0e62c19297b2a10408c56a14e3ad6a5777303ee49e108b714c63cb2587d6d5ca6b06
7
- data.tar.gz: 0f6f5b588846e1d73af3df24a3d9244bd682c084530324a18421e0e4b32a03b6c647a252291673bd74c595d6ded71b6ad270382bf0949891fee043547d63d7a0
6
+ metadata.gz: 870916a0477ad23ebd5ae68ed5649f91de95e710309cc846509a74541bdebce734ec715c87c1d016944d5b0772e826031a41d4673465ef6752d38a8358b688ad
7
+ data.tar.gz: '019eacadcfe2f1c978e4d208048fa74b48a7663dd05e85ea6046b2f25f0a6b11a53562f4af0b24f0098d0398b5700be6e18d7931cc0729cca27b0292c732145c'
@@ -7,6 +7,8 @@ end
7
7
 
8
8
  module Mumukit::Auth
9
9
  class Grant
10
+ delegate :organization, to: :to_mumukit_slug
11
+
10
12
  def as_json(options={})
11
13
  to_s
12
14
  end
@@ -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 { |grant| grant.to_mumukit_slug.organization }.to_set
53
+ scope_for(role)&.grants&.map(&:organization).to_set
46
54
  end
47
55
 
48
56
  def add_permission!(role, *grants)
@@ -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
@@ -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|
@@ -1,5 +1,5 @@
1
1
  module Mumukit
2
2
  module Auth
3
- VERSION = '7.7.0'
3
+ VERSION = '7.11.0'
4
4
  end
5
5
  end
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.7.0
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: 2019-06-21 00:00:00.000000000 Z
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: '1.7'
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: '1.7'
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: '10.0'
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: '10.0'
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: '2'
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: '2'
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.4
122
+ rubygems_version: 3.0.3
123
123
  signing_key:
124
124
  specification_version: 4
125
125
  summary: Library for authorizing mumuki requests