Class: Permission
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Permission
- Defined in:
- app/models/permission.rb
Instance Method Summary collapse
- #cache_conds ⇒ Object
- #destroy_caches ⇒ Object
- #destroy_caches_for_person(p) ⇒ Object
- #grantee ⇒ Object
- #object ⇒ Object
Instance Method Details
#cache_conds ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/models/permission.rb', line 18 def cache_conds cond_sql = "permission_name = ?" cond_objs = [] if person cond_sql += " and person_id = ?" cond_objs += [person.id] end if cond_sql += " and permissioned_type = ? and permissioned_id = ?" cond_objs += [.class.name, .id] end return [cond_sql] + cond_objs end |
#destroy_caches ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'app/models/permission.rb', line 42 def destroy_caches if AeUsers. if person destroy_caches_for_person(person) elsif role role.members.each do |person| AeUsers..invalidate(person, , ) end elsif and AeUsers..invalidate_all(:permissioned => , :permission => ) else AeUsers..invalidate_all end end end |
#destroy_caches_for_person(p) ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'app/models/permission.rb', line 32 def destroy_caches_for_person(p) if AeUsers. if and AeUsers..invalidate(p, , ) else AeUsers..invalidate_all(:person => p) end end end |
#grantee ⇒ Object
10 11 12 13 14 15 16 |
# File 'app/models/permission.rb', line 10 def grantee if not role.nil? return role else return person end end |
#object ⇒ Object
6 7 8 |
# File 'app/models/permission.rb', line 6 def object return end |