puavo_authentication 0.0.9 → 0.0.10
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.
@@ -0,0 +1,21 @@
|
|
1
|
+
module Puavo
|
2
|
+
module Authorization
|
3
|
+
def self.current_user
|
4
|
+
Thread.current["current_user"]
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.current_user=(user)
|
8
|
+
Thread.current["current_user"] = user
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.organisation_owner?
|
12
|
+
if Puavo::Authorization.current_user
|
13
|
+
unless Thread.current["owners"]
|
14
|
+
Thread.current["owners"] = LdapOrganisation.current.owner
|
15
|
+
end
|
16
|
+
return Thread.current["owners"].include?(Puavo::Authorization.current_user.dn)
|
17
|
+
end
|
18
|
+
return false
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -84,6 +84,14 @@ module PuavoAuthentication
|
|
84
84
|
ActiveLdap::Base.remove_connection(connection_name)
|
85
85
|
end
|
86
86
|
end
|
87
|
+
|
88
|
+
def organisation_owner?
|
89
|
+
Puavo::Authorization.organisation_owner?
|
90
|
+
end
|
91
|
+
|
92
|
+
def set_authorization_user
|
93
|
+
Puavo::Authorization.current_user = current_user if current_user
|
94
|
+
end
|
87
95
|
end
|
88
96
|
end
|
89
97
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puavo_authentication
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 10
|
10
|
+
version: 0.0.10
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jouni Korhonen
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-02-04 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|
@@ -37,6 +37,7 @@ files:
|
|
37
37
|
- app/views/sessions/new.html.erb
|
38
38
|
- init.rb
|
39
39
|
- lib/puavo/authentication.rb
|
40
|
+
- lib/puavo/authorization.rb
|
40
41
|
- lib/puavo/connection.rb
|
41
42
|
- lib/puavo_authentication.rb
|
42
43
|
- lib/puavo_authentication/controllers/helpers.rb
|