Class: Group

Inherits:
ApplicationRecord
  • Object
show all
Includes:
Checkable, HasUuid, TreeStructure
Defined in:
app/models/group.rb

Overview

ACL group

Attributes:

biovision_component_id [BiovisionComponent]
data [jsonb]
children_cache [Array<integer>]
parent_id [Group], optional
parents_cache [string]
slug [string]
user_count [Integer]
uuid [uuid]

Constant Summary collapse

SLUG_LIMIT =
50
SLUG_PATTERN =
/\A[a-z][_a-z]*[a-z]\z/.freeze

Instance Method Summary collapse

Instance Method Details

#rolesObject



32
33
34
# File 'app/models/group.rb', line 32

def roles
  Role.where(id: role_groups.where(group_id: branch_ids).pluck(:role_id).uniq)
end

#user_idsObject



40
41
42
43
# File 'app/models/group.rb', line 40

def user_ids
  # user_groups.where(group_id: branch_ids).pluck(:user_id).uniq
  []
end

#usersObject



36
37
38
# File 'app/models/group.rb', line 36

def users
  User.where(id: user_ids)
end

#users_changed!Object



45
46
47
# File 'app/models/group.rb', line 45

def users_changed!
  roles.each(&:count_users!)
end