2015-03-12 22:43:13 +00:00
|
|
|
class GroupPolicy < ApplicationPolicy
|
|
|
|
|
2015-03-17 22:33:16 +00:00
|
|
|
def index?
|
|
|
|
!user.guest?
|
|
|
|
end
|
|
|
|
|
|
|
|
def show?
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
def create?
|
|
|
|
!user.guest?
|
|
|
|
end
|
|
|
|
|
|
|
|
def reader?
|
|
|
|
local_reader?
|
|
|
|
end
|
|
|
|
|
|
|
|
def write?
|
|
|
|
owner? || local_writer?
|
|
|
|
end
|
|
|
|
|
|
|
|
def update?
|
|
|
|
owner? || local_admin?
|
|
|
|
end
|
2015-03-18 22:02:38 +00:00
|
|
|
alias_method :manage_members?, :update?
|
|
|
|
alias_method :members?, :update?
|
|
|
|
alias_method :add_member?, :update?
|
|
|
|
alias_method :remove_member?, :update?
|
|
|
|
alias_method :remove_members?, :update?
|
|
|
|
alias_method :update_member?, :update?
|
|
|
|
|
|
|
|
def destroy?
|
|
|
|
owner?
|
|
|
|
end
|
|
|
|
|
|
|
|
def remove_user?
|
|
|
|
!user.guest?
|
|
|
|
end
|
2015-03-17 22:33:16 +00:00
|
|
|
|
2015-03-12 22:43:13 +00:00
|
|
|
end
|