sso-auth 0.0.4 → 0.0.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,10 +14,10 @@ module SsoAuth
14
14
  end
15
15
  end
16
16
 
17
- def user_with_role(role, context=nil, prefix=nil)
17
+ def user_with_role(role, context=nil, prefix=nil, user=nil)
18
18
  @roles ||= {}
19
19
  @roles["#{prefix}_#{role}"] ||= {}
20
- @roles["#{prefix}_#{role}"][context] ||= create_user.tap do |user|
20
+ @roles["#{prefix}_#{role}"][context] ||= (user || create_user).tap do |user|
21
21
  user.permissions.create! :context => context, :role => role
22
22
  end
23
23
  end
@@ -31,14 +31,14 @@ module SsoAuth
31
31
  end
32
32
 
33
33
  Permission.available_roles.each do | role |
34
- define_method "#{role}_of" do |context|
35
- user_with_role role, context
34
+ define_method "#{role}_of" do |context, params={}|
35
+ user_with_role role, context, nil, params[:user]
36
36
  end
37
37
  define_method "#{role}" do
38
38
  self.send("#{role}_of", nil)
39
39
  end
40
- define_method "another_#{role}_of" do |context|
41
- user_with_role role, context, "another"
40
+ define_method "another_#{role}_of" do |context, params={}|
41
+ user_with_role role, context, "another", params[:user]
42
42
  end
43
43
  define_method "another_#{role}" do
44
44
  self.send("another_#{role}_of", nil)
@@ -1,3 +1,3 @@
1
1
  module SsoAuth
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.4.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sso-auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.4.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-21 00:00:00.000000000 Z
12
+ date: 2012-11-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cancan
@@ -216,7 +216,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
216
216
  version: '0'
217
217
  segments:
218
218
  - 0
219
- hash: 2989266843877059393
219
+ hash: 494012044401303500
220
220
  required_rubygems_version: !ruby/object:Gem::Requirement
221
221
  none: false
222
222
  requirements:
@@ -225,7 +225,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
225
225
  version: '0'
226
226
  segments:
227
227
  - 0
228
- hash: 2989266843877059393
228
+ hash: 494012044401303500
229
229
  requirements: []
230
230
  rubyforge_project:
231
231
  rubygems_version: 1.8.24