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

Instance Method Details

#abilityObject



82
83
84
# File 'lib/sufia/user.rb', line 82

def ability
  @ability ||= Ability.new(self)
end

#email_addressObject



59
60
61
# File 'lib/sufia/user.rb', line 59

def email_address
  return self.email
end

#groupsObject

The basic groups method, override or will fallback to Sufia::Ldap::User



78
79
80
# File 'lib/sufia/user.rb', line 78

def groups
  return self.group_list ? self.group_list.split(";?;") : []
end

#mailboxer_email(obj = nil) ⇒ Object

method needed for messaging



73
74
75
# File 'lib/sufia/user.rb', line 73

def mailboxer_email(obj=nil)
  return nil
end

#nameObject



63
64
65
# File 'lib/sufia/user.rb', line 63

def name
  return self.display_name.titleize || self.user_key rescue self.user_key
end

#to_paramObject

Redefine this for more intuitive keys in Redis



68
69
70
# File 'lib/sufia/user.rb', line 68

def to_param
  user_key
end

#to_sObject



55
56
57
# File 'lib/sufia/user.rb', line 55

def to_s
  user_key
end

#user_keyObject

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.



51
52
53
# File 'lib/sufia/user.rb', line 51

def user_key
  send(Devise.authentication_keys.first)
end