Module: SimplePermissions::UserModelMethods
- Defined in:
- lib/user_model.rb
Instance Method Summary collapse
- #has_permission_read_write(permission_code, read_write) ⇒ Object
- #has_permission_read_write!(permission_code, read_write) ⇒ Object
- #has_permission_role(permission_code) ⇒ Object
- #has_permission_role!(permission_code) ⇒ Object
Instance Method Details
#has_permission_read_write(permission_code, read_write) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/user_model.rb', line 23 def (, read_write) = self.send SimplePermissions::Config. .each do |per_code, per_read_write| if .to_s == per_code.to_s if read_write.to_s == 'w' if per_read_write.to_s == 'w' return true end else return true end end end return false end |
#has_permission_read_write!(permission_code, read_write) ⇒ Object
19 20 21 |
# File 'lib/user_model.rb', line 19 def (, read_write) raise SimplePermissions::AccessDeniedException if !self.(, read_write) end |
#has_permission_role(permission_code) ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/user_model.rb', line 8 def () = self.send SimplePermissions::Config. .each do |per_code| if .to_s == per_code.to_s return true end end return false end |
#has_permission_role!(permission_code) ⇒ Object
4 5 6 |
# File 'lib/user_model.rb', line 4 def () raise SimplePermissions::AccessDeniedException if !self.() end |