Archived
Model commit
This commit is contained in:
1 parent
79f005c88e
commit
f5c080efd4
7 files changed
+71
-3
No files matched your search
@@ -16,11 +16,13 @@ class User
|
||||
has_many :privilege_apps, :inverse_of => :privilege_users, :class_name => "AppAuth"
|
||||
|
||||
has_many :managing_apps,:class_name => "AppManager"
|
||||
|
||||
has_one :desktop, :autosave => true, :dependent => :destroy
|
||||
belongs_to :role
|
||||
has_and_belongs_to_many :sub_roles
|
||||
accepts_nested_attributes_for :attribute_values, :allow_destroy => true
|
||||
|
||||
before_create :initialize_desktop
|
||||
|
||||
def avb_apps
|
||||
sub_role_ids_ary=self.sub_roles.collect{|t| t.id}
|
||||
query1 = AppAuth.any_in({sub_role_ids: sub_role_ids_ary}).excludes(blocked_user_ids: self.id)
|
||||
@@ -53,4 +55,8 @@ class User
|
||||
User.find(id) rescue nil
|
||||
end
|
||||
|
||||
def initialize_desktop
|
||||
self.build_desktop
|
||||
end
|
||||
|
||||
end
|
||||
Reference in new issue
Block a user