organizations_controller_policy.rb 434 B

1234567891011
  1. class Controllers::OrganizationsControllerPolicy < Controllers::ApplicationControllerPolicy
  2. permit! :import_example, to: 'admin.organization'
  3. permit! :import_start, to: 'admin.user'
  4. permit! %i[create update destroy search history], to: ['ticket.agent', 'admin.organization']
  5. def show?
  6. return true if user.permissions?(['ticket.agent', 'admin.organization'])
  7. record.params[:id].to_i == user.organization_id
  8. end
  9. end