Module: Sufia::User
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/sufia/user.rb
Overview
Copyright © 2012 The Pennsylvania State University
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #ability ⇒ Object
- #email_address ⇒ Object
-
#groups ⇒ Object
The basic groups method, override or will fallback to Sufia::Ldap::User.
-
#mailboxer_email(obj = nil) ⇒ Object
method needed for messaging.
- #name ⇒ Object
-
#to_param ⇒ Object
Redefine this for more intuitive keys in Redis.
- #to_s ⇒ Object
-
#trophies ⇒ Object
method needed for trophies.
-
#trophy_ids ⇒ Object
method to get the trophy ids without the namespace included.
-
#user_key ⇒ Object
This method should display the unique identifier for this user as defined by devise.
Instance Method Details
#ability ⇒ Object
96 97 98 |
# File 'lib/sufia/user.rb', line 96 def ability @ability ||= Ability.new(self) end |
#email_address ⇒ Object
56 57 58 |
# File 'lib/sufia/user.rb', line 56 def email_address return self.email end |
#groups ⇒ Object
The basic groups method, override or will fallback to Sufia::Ldap::User
92 93 94 |
# File 'lib/sufia/user.rb', line 92 def groups return self.group_list ? self.group_list.split(";?;") : [] end |
#mailboxer_email(obj = nil) ⇒ Object
method needed for messaging
87 88 89 |
# File 'lib/sufia/user.rb', line 87 def mailboxer_email(obj=nil) return nil end |
#name ⇒ Object
60 61 62 |
# File 'lib/sufia/user.rb', line 60 def name return self.display_name.titleize || self.user_key rescue self.user_key end |
#to_param ⇒ Object
Redefine this for more intuitive keys in Redis
65 66 67 68 |
# File 'lib/sufia/user.rb', line 65 def to_param # hack because rails doesn't like periods in urls. user_key.gsub(/\./, '-dot-') end |
#to_s ⇒ Object
52 53 54 |
# File 'lib/sufia/user.rb', line 52 def to_s user_key end |
#trophies ⇒ Object
method needed for trophies
71 72 73 74 |
# File 'lib/sufia/user.rb', line 71 def trophies trophies = Trophy.where(user_id:self.id) return trophies end |
#trophy_ids ⇒ Object
method to get the trophy ids without the namespace included
77 78 79 80 81 82 83 84 |
# File 'lib/sufia/user.rb', line 77 def trophy_ids trophies=[] trophies.each do |t| @trophies << GenericFile.find("#{Sufia::Engine.config.id_namespace}:#{t.generic_file_id}") end return trophies end |
#user_key ⇒ Object
This method should display the unique identifier for this user as defined by devise. The unique identifier is what access controls will be enforced against.
48 49 50 |
# File 'lib/sufia/user.rb', line 48 def user_key send(Devise.authentication_keys.first) end |