class UserGroupPolicy < ApplicationPolicy def index? true end def show? true end def create? true if user.try(:has_role?, 'Administrator') end def update? true if user.try(:has_role?, 'Administrator') end def destroy? return false unless record.profiles.empty? user.try(:has_role?, 'Administrator') end end