Created
October 11, 2016 15:40
-
-
Save Andrew8xx8/0eca7d277551135eec64b34117c4a244 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
can [:memberships, :members], Organization do |organization| | |
@user.has_role?(:resource_administrator, organization) | |
all_childrens = @user.admined_organizations.map do |user_admined_organization| | |
user_admined_organization.actable.get_descendent_memberships.where(member_type: Organization.types) | |
end | |
all_childrens.flatten.map do |membership| | |
membership.member == organization.actable | |
end.reduce(&:|) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment