Merge commit '7c55f6fb8850ef426978dd422fa782358f9ec2fe' into ldap
Conflicts: config/environments/development.rb
This commit is contained in:
commit
7f05f21930
63 files changed
+1358
-985
No files matched your search
@@ -2,4 +2,5 @@ class AppAuth < PrototypeAuth
|
||||
|
||||
belongs_to :module_app
|
||||
|
||||
|
||||
end
|
||||
@@ -1,6 +1,7 @@
|
||||
class ModuleApp
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
include OrbitCoreLib::ObjectTokenUnility
|
||||
|
||||
field :key
|
||||
field :title
|
||||
@@ -14,7 +15,7 @@ class ModuleApp
|
||||
|
||||
field :app_pages ,type: Array
|
||||
field :widgets ,type: Array
|
||||
|
||||
|
||||
has_many :managers,as: :managing_app ,:class_name => "AppManager" #,:dependent => :destroy,:foreign_key => "managing_app_id",:inverse_of => :managing_app
|
||||
has_many :sub_managers,as: :sub_managing_app ,:class_name => "AppManager"#, :dependent => :destroy,:foreign_key => "sub_managing_app_id",:inverse_of => :sub_managing_app
|
||||
|
||||
@@ -26,6 +27,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
|
||||
@@ -73,5 +82,6 @@ class ModuleApp
|
||||
def set_key
|
||||
self.key = self.title.underscore if self.title
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
@@ -1,5 +1,6 @@
|
||||
class ObjectAuth < PrototypeAuth
|
||||
|
||||
include OrbitCoreLib::ObjectTokenUnility
|
||||
validates_uniqueness_of :obj_authable_type,:scope => :title #{ |c| }
|
||||
belongs_to :obj_authable, polymorphic: true
|
||||
# > - Something.find_with_auth(query)
|
||||
# > - or Something.find(query).auth
|
||||
|
||||
@@ -4,7 +4,6 @@ class PrototypeAuth
|
||||
# after_save :update_block_list,:update_privilage_list
|
||||
|
||||
field :title
|
||||
field :token
|
||||
field :all ,type: Boolean,default: false
|
||||
|
||||
belongs_to :users
|
||||
@@ -12,11 +11,12 @@ class PrototypeAuth
|
||||
has_and_belongs_to_many :blocked_users, :inverse_of => nil, :class_name => "User"
|
||||
has_and_belongs_to_many :privilege_users, :inverse_of => nil, :class_name => "User"
|
||||
|
||||
|
||||
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)
|
||||
@@ -68,7 +68,7 @@ class PrototypeAuth
|
||||
end
|
||||
end
|
||||
|
||||
def auth_users
|
||||
def auth_users_before_block_list
|
||||
if self.all?
|
||||
User.all.entries
|
||||
else
|
||||
@@ -83,11 +83,10 @@ class PrototypeAuth
|
||||
end
|
||||
end
|
||||
|
||||
def auth_users_after_block_list
|
||||
auth_users - self.blocked_users
|
||||
def auth_users
|
||||
auth_users_before_block_list - self.blocked_users
|
||||
end
|
||||
|
||||
# protected
|
||||
|
||||
|
||||
end
|
||||
Reference in new issue
Block a user