Class: GroupPolicy

Inherits:
BasePolicy show all
Includes:
FindGroupProjects
Defined in:
app/policies/group_policy.rb

Instance Attribute Summary

Attributes inherited from DeclarativePolicy::Base

#subject, #user

Instance Method Summary collapse

Methods included from FindGroupProjects

#group_projects_for

Methods inherited from DeclarativePolicy::Base

ability_map, #allowed?, #banned?, #cache, #cached?, #can?, #condition, condition, conditions, configuration_for, #debug, delegate, #delegated_policies, delegations, desc, #disallowed?, enable_when, global_actions, #initialize, #inspect, last_options, last_options!, overrides, own_ability_map, own_conditions, own_delegations, own_global_actions, #policy_for, prevent_all_when, prevent_when, #repr, rule, #runner, with_options, with_scope, with_score

Constructor Details

This class inherits a constructor from DeclarativePolicy::Base

Instance Method Details

#access_levelObject


169
170
171
172
173
174
# File 'app/policies/group_policy.rb', line 169

def access_level
  return GroupMember::NO_ACCESS if @user.nil?
  return GroupMember::NO_ACCESS unless user_is_user?

  @access_level ||= lookup_access_level!
end

#lookup_access_level!Object


176
177
178
# File 'app/policies/group_policy.rb', line 176

def lookup_access_level!
  @subject.max_member_access_for_user(@user)
end