Class: Formol::Permissions::Manager
- Inherits:
-
Object
- Object
- Formol::Permissions::Manager
- Defined in:
- lib/formol/permissions/manager.rb
Instance Attribute Summary collapse
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
- #able_to?(right, obj = nil) ⇒ Boolean
-
#initialize(user) ⇒ Manager
constructor
A new instance of Manager.
Constructor Details
#initialize(user) ⇒ Manager
Returns a new instance of Manager.
7 8 9 10 |
# File 'lib/formol/permissions/manager.rb', line 7 def initialize(user) self.user = user @profile_name = (user && user.persisted? ? user.formol_profile : :default).to_sym end |
Instance Attribute Details
#user ⇒ Object
Returns the value of attribute user.
4 5 6 |
# File 'lib/formol/permissions/manager.rb', line 4 def user @user end |
Instance Method Details
#able_to?(right, obj = nil) ⇒ Boolean
12 13 14 15 16 |
# File 'lib/formol/permissions/manager.rb', line 12 def able_to?(right, obj = nil) return true if has_right?(:administrate) respond_to?(m = :"able_to_#{right}?") ? send(m, obj) : has_right?(right) end |