invitational 1.3.1 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -0
- data/app/modules/invitational/invitation_core.rb +1 -1
- data/app/modules/invitational/invited_to.rb +4 -0
- data/lib/invitational/cancan.rb +3 -2
- data/lib/invitational/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa0308853121b61e0485e83fabfe5bec0fcca305
|
4
|
+
data.tar.gz: 89208f4dd480f07394e1ed7b6f25c99dc5d055d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 299d2c4a4931fc17593d46fdc3aea3bf15e5f8fa76187e2b32ed104b52efe6e47c3ba2bb432f0911b334b3eacef54d9f918016a3026356d6bb7a03521b8d4f1c
|
7
|
+
data.tar.gz: 3088c2e22b59d5853a34dd83debfd46fb3b1cb7911d0d29a41a9cfd56270ef47491c72b57507945bfb0b70e59885748e6c563516c12e42e82d34cf0c27784717
|
data/README.md
CHANGED
@@ -114,6 +114,14 @@ License.contract_managers
|
|
114
114
|
License.bookkeepers
|
115
115
|
```
|
116
116
|
|
117
|
+
Similarly, the identity model is given scopes for each role:
|
118
|
+
|
119
|
+
```
|
120
|
+
User.uberadmins # returns users who are uberadmins
|
121
|
+
User.contract_managers # returns users with the contract_manager system role
|
122
|
+
User.bookkeepers # returns users with the bookkeepers system role
|
123
|
+
```
|
124
|
+
|
117
125
|
#Usage
|
118
126
|
##Creating Invitations
|
119
127
|
To create an entity invitation to a given model:
|
@@ -4,6 +4,10 @@ module Invitational
|
|
4
4
|
|
5
5
|
included do
|
6
6
|
has_many :invitations, dependent: :destroy
|
7
|
+
|
8
|
+
Invitation.system_roles.each do |role_name|
|
9
|
+
scope role_name.to_s.pluralize, -> { joins(:invitations).merge Invitation.for_system_role(role_name) }
|
10
|
+
end
|
7
11
|
end
|
8
12
|
|
9
13
|
module ClassMethods
|
data/lib/invitational/cancan.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
module Invitational
|
2
2
|
module CanCan
|
3
3
|
module Ability
|
4
|
+
include ::CanCan::Ability
|
4
5
|
|
5
6
|
def can(action = nil, subject = nil, conditions = nil, &block)
|
6
7
|
if conditions && conditions.has_key?(:roles)
|
@@ -10,7 +11,7 @@ module Invitational
|
|
10
11
|
block ||= setup_role_based_block_for roles, subject, action, false
|
11
12
|
end
|
12
13
|
|
13
|
-
|
14
|
+
add_rule ::CanCan::Rule.new(true, action, subject, conditions, block)
|
14
15
|
end
|
15
16
|
|
16
17
|
def cannot(action = nil, subject = nil, conditions = nil, &block)
|
@@ -21,7 +22,7 @@ module Invitational
|
|
21
22
|
block ||= setup_role_based_block_for roles, subject, action, true
|
22
23
|
end
|
23
24
|
|
24
|
-
|
25
|
+
add_rule ::CanCan::Rule.new(false, action, subject, conditions, block)
|
25
26
|
end
|
26
27
|
|
27
28
|
def setup_role_based_block_for roles, subject, action, role_specific
|
data/lib/invitational/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: invitational
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dave Goerlich
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -175,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
175
175
|
version: '0'
|
176
176
|
requirements: []
|
177
177
|
rubyforge_project:
|
178
|
-
rubygems_version: 2.
|
178
|
+
rubygems_version: 2.4.8
|
179
179
|
signing_key:
|
180
180
|
specification_version: 4
|
181
181
|
summary: Solution that eliminates the tight coupling between user identity/authentication
|