Sha256: 4f207df399cbd820d734e233ae27c309c845279f35462679295fb3f8c9e577e1
Contents?: true
Size: 756 Bytes
Versions: 9
Compression:
Stored size: 756 Bytes
Contents
# frozen_string_literal: true require 'proxes/policies/application_policy' module ProxES class UserPolicy < ApplicationPolicy def create? user && user.super_admin? end def list? create? end def read? user && (record.id == user.id || user.super_admin?) end def update? read? end def delete? create? end def register? true end def permitted_attributes attribs = [:email, :name, :surname] attribs << :role_id if user.super_admin? attribs end class Scope < ApplicationPolicy::Scope def resolve if user && user.super_admin? scope else scope.where(id: -1) end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems