sq_auth 0.0.27 → 0.0.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -108,6 +108,10 @@ module SqAuth
108
108
  @session_provider.user.user_name = name
109
109
  end
110
110
 
111
+ def session_for_current_user
112
+ @session_provider.session_for_current_user
113
+ end
114
+
111
115
  def login_to
112
116
  uri = @session_provider.auth_server_uri
113
117
  uri.path = "#@login_path"
@@ -1,3 +1,3 @@
1
1
  module SqAuth
2
- VERSION = "0.0.27"
2
+ VERSION = "0.0.28"
3
3
  end
data/lib/sq_auth.rb CHANGED
@@ -45,12 +45,22 @@ module SqAuth
45
45
  SqAuth.with_sq_auth([*roles], SqAuth.access.project_name, {:binding => binding}, &block)
46
46
  end
47
47
 
48
+ def access_project_for(project, roles, options, &block)
49
+ SqAuth.with_sq_auth([*roles], project, options, &block)
50
+ end
51
+
48
52
  alias :draw_for :access_for
49
53
 
50
54
  def accessed_by?(*roles)
51
55
  SqAuth.access.sq_auth_filter([*roles])
52
56
  end
53
57
 
58
+ def accessed_by_any_of? projects_hash
59
+ projects_hash.inject(false) do |sum, (project, roles)|
60
+ sum = sum || SqAuth.access.sq_auth_filter([*roles], project)
61
+ end
62
+ end
63
+
54
64
  def not_accessible_message
55
65
  SqAuth.access.message_when_not_authenticated
56
66
  end
@@ -58,6 +68,10 @@ module SqAuth
58
68
  def not_accessible_link(*roles)
59
69
  SqAuth.access.draw_when_not_authenticated(roles)
60
70
  end
71
+
72
+ def current_session
73
+ SqAuth.access.session_for_current_user
74
+ end
61
75
  end
62
76
 
63
77
  include SqAuth
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sq_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.27
4
+ version: 0.0.28
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-07-17 00:00:00.000000000Z
12
+ date: 2012-08-02 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake