User#owned_groups is now respect group membership
This commit is contained in:
parent
be26d2724b
commit
0273b79b92
|
@ -74,6 +74,8 @@ class User < ActiveRecord::Base
|
|||
|
||||
# Groups
|
||||
has_many :own_groups, class_name: "Group", foreign_key: :owner_id
|
||||
has_many :owned_groups, through: :users_groups, source: :group, conditions: { users_groups: { group_access: UsersGroup::OWNER } }
|
||||
|
||||
has_many :users_groups, dependent: :destroy
|
||||
has_many :groups, through: :users_groups
|
||||
|
||||
|
@ -225,11 +227,6 @@ class User < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
# Groups where user is an owner
|
||||
def owned_groups
|
||||
own_groups
|
||||
end
|
||||
|
||||
# Groups user has access to
|
||||
def authorized_groups
|
||||
@authorized_groups ||= begin
|
||||
|
|
Loading…
Reference in New Issue