First version for App and Object auth.Taking Announcement as experiment
This commit is contained in:
1 parent
3bcd7ea349
commit
cc550c5745
28 files changed
+146
-34
No files matched your search
@@ -2,4 +2,5 @@ class AppAuth < PrototypeAuth
|
||||
|
||||
belongs_to :module_app
|
||||
|
||||
|
||||
end
|
||||
@@ -26,6 +26,14 @@ class ModuleApp
|
||||
|
||||
before_save :set_key
|
||||
|
||||
def is_manager?(user)
|
||||
managing_users.include?(user)
|
||||
end
|
||||
|
||||
def is_sub_manager?(user)
|
||||
sub_managing_users.include?(user) || is_manager?(user)
|
||||
end
|
||||
|
||||
def managing_users
|
||||
self.managers.collect{ |t| t.user }
|
||||
end
|
||||
|
||||
@@ -16,7 +16,7 @@ class PrototypeAuth
|
||||
has_and_belongs_to_many :roles
|
||||
has_and_belongs_to_many :sub_roles
|
||||
|
||||
attr_protected :roles,:sub_roles,:privilege_users,:blocked_users,:users
|
||||
attr_protected :roles,:sub_roles,:privilege_users,:blocked_users
|
||||
|
||||
def add_role role
|
||||
add_operation(:roles,role)
|
||||
|
||||
Reference in new issue
Block a user