started implementing teams
This commit is contained in:
14
app/policies/team_policy.rb
Normal file
14
app/policies/team_policy.rb
Normal file
@@ -0,0 +1,14 @@
|
||||
class TeamPolicy < ApplicationPolicy
|
||||
[:create?, :index?, :new?].each do |action|
|
||||
define_method(action) { @user.internal? }
|
||||
end
|
||||
|
||||
[:destroy?, :edit?, :show?, :update?].each do |action|
|
||||
define_method(action) { admin? || member? }
|
||||
end
|
||||
|
||||
def member?
|
||||
@record.members.include?(@user)
|
||||
end
|
||||
private :member?
|
||||
end
|
Reference in New Issue
Block a user