app/models/ability.rb
def groups_from_policy(access:, policy_id:)
    groups = []
    policy_permissions = policy_permissions_doc(policy_id)

    if policy_permissions.present?
      field_name = Hydra.config.permissions.inheritable[access][:group]
      groups = read_groups_from_policy(policy_id) |
               policy_permissions.fetch(field_name, [])
    end

    Rails.logger.debug("[CANCAN] -policy- #{access}_groups: #{groups.inspect}")
    groups
  end
# Returns the list of groups that are granted DISCOVER access
# by the policy object identified by policy_id.
# Note:  Edit or read access implies discover access, so the
# resulting list of groups is the union of edit, read, and
# discover groups.
#
# @param [Symbol] access E.g., :discover, :read
# @param [AdminPolicy] policy_id
Returns the list of groups that are granted DISCOVER access
by the policy object identified by policy_id.
Note:  Edit or read access implies discover access, so the
resulting list of groups is the union of edit, read, and
discover groups.
Returns the list of groups that are granted DISCOVER access by the policy object identified by policy_id . Note : Edit or read access implies discover access so the resulting list of groups is the union of edit read and discover groups .
def groups_from_policy(access:, policy_id:)
    groups = []
    policy_permissions = policy_permissions_doc(policy_id)
    if policy_permissions.present?
      field_name = Hydra.config.permissions.inheritable[access][:group]
      groups = read_groups_from_policy(policy_id) |
               policy_permissions.fetch(field_name, [])
    end
    Rails.logger.debug("[CANCAN] -policy- #{access}_groups: #{groups.inspect}")
    groups
  end
def groups_from_policy ( access : , policy_id : ) groups = [ ] policy_permissions = policy_permissions_doc ( policy_id ) if policy_permissions . present? field_name = Hydra . config . permissions . inheritable [ access ] [ :group ] groups = read_groups_from_policy ( policy_id ) | policy_permissions . fetch ( field_name , [ ] ) end Rails . logger . debug ( "[CANCAN] -policy- #{access}_groups: #{groups.inspect}" ) groups end
Returns the list of groups that are granted DISCOVER access
by the policy object identified by policy_id.
Returns the list of groups that are granted DISCOVER access by the policy object identified by policy_id .
access
policy_id
None