puavo_authentication 0.0.17 → 0.0.18

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.
@@ -7,7 +7,12 @@ module PuavoAuthentication
7
7
  return @current_user
8
8
  else
9
9
  begin
10
- return @current_user = User.find(session[:dn]) # REST/OAuth?
10
+ if session[:dn].to_s.match(/ou=People/)
11
+ return @current_user = User.find(session[:dn])
12
+ else
13
+ # If user is ExternalService return nil
14
+ logger.info "current_user is ExternalServier user: #{session[:dn]}"
15
+ end
11
16
  rescue
12
17
  logger.info "Session's user not found! User is removed from ldap server."
13
18
  logger.info "session[:dn]: #{session[:dn]}"
@@ -96,6 +101,13 @@ module PuavoAuthentication
96
101
  def set_authorization_user
97
102
  Puavo::Authorization.current_user = current_user if current_user
98
103
  end
104
+
105
+ def remove_authorization_user
106
+ if Puavo::Authorization.current_user
107
+ logger.debug "Remove authorization user: " + Puavo::Authorization.current_user.dn.inspect
108
+ end
109
+ Puavo::Authorization.current_user = nil
110
+ end
99
111
  end
100
112
  end
101
113
  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: 61
4
+ hash: 59
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 17
10
- version: 0.0.17
9
+ - 18
10
+ version: 0.0.18
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: 2012-03-27 00:00:00 +03:00
18
+ date: 2012-09-21 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies: []
21
21