mumukit-auth 7.1.0 → 7.2.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
- SHA1:
3
- metadata.gz: 6dc8efe9a719847890a69555ecbef9b9d3844d9e
4
- data.tar.gz: a7547aa226ea437d6dc4d096776187fb367b122b
2
+ SHA256:
3
+ metadata.gz: 58505a2138bb6e192ab493e268f4e6d2553bace07c0e32910d6f0f0dc64ad3d5
4
+ data.tar.gz: 714d15dcc9b2d37efc17479459c45308c3d01d7e36d941784a15f0859cea42e4
5
5
  SHA512:
6
- metadata.gz: 7646c11a128f13f494916e732149852cc3457f069376e6b42dbab74dec87787df6c6d3737bfda2c568b236ff7d012c4eddb743cf19528f0ce4d4b1b92e176cd3
7
- data.tar.gz: 766d4c5a3391052ac1fabe125a9d891dd69d75f6eb9e7a9b523133fd5d8c9fd4c47b7774c8a51b4c5ac6404766cb509d6eb9b419453db63201abbaea52d7caab
6
+ metadata.gz: 1b95000d71d18d3222103bef492dfe0c933f92f4116c6ffdc6d7cd2947863616e9bff8437f97d58ddb9bc106c7f436516977884c5c2ed49265bd03502081925f
7
+ data.tar.gz: 863d6d8233f62803b71dba8f943fc7c21e89a8200b01552177dcc0d09e868d2ecc05695ad345eb402029d7980cc515969b98638957e4542c52a8c09633e05a1e
@@ -79,6 +79,15 @@ class Mumukit::Auth::Permissions
79
79
  permission.to_json
80
80
  end
81
81
 
82
+ def assign_to?(other, previous)
83
+ diff = previous.as_set ^ other.as_set
84
+ diff.all? { |role, grant| has_permission?(role, grant) }
85
+ end
86
+
87
+ def as_set
88
+ Set.new scopes.flat_map { |role, scope| scope.grants.map {|grant| [role, grant]} }
89
+ end
90
+
82
91
  private
83
92
 
84
93
  def has_all_permissions?(role, scope)
@@ -1,5 +1,5 @@
1
1
  module Mumukit
2
2
  module Auth
3
- VERSION = '7.1.0'
3
+ VERSION = '7.2.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.1.0
4
+ version: 7.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: 2017-05-01 00:00:00.000000000 Z
11
+ date: 2018-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -56,16 +56,16 @@ dependencies:
56
56
  name: jwt
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: '1.5'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: '1.5'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: mumukit-core
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  version: '0'
121
121
  requirements: []
122
122
  rubyforge_project:
123
- rubygems_version: 2.4.5
123
+ rubygems_version: 2.7.4
124
124
  signing_key:
125
125
  specification_version: 4
126
126
  summary: Library for authorizing mumuki requests