Sha256: 4d5da682553d67f8027c81b4d06bd626d4d368b5fbce8969446ffa6d6b560479
Contents?: true
Size: 850 Bytes
Versions: 17
Compression:
Stored size: 850 Bytes
Contents
# frozen_string_literal: true # generado con pg_rails class UserPolicy < ApplicationPolicy class Scope < ApplicationPolicy::Scope def resolve if Current.namespace == :admin scope.all elsif Current.account.present? ids = Current.account.user_accounts.ua_active.pluck(:user_id) scope.where(id: ids) else scope.none end end end # def puede_editar? # acceso_total? && !record.readonly? # end # def puede_crear? # acceso_total? || user.asesor? # end # def puede_borrar? # acceso_total? && !record.readonly? # end def puede_editar? base_access_to_record? end def new_from_associable? false end def base_access_to_record? Current.namespace == :admin || user == record end def base_access_to_collection? user.present? end end
Version data entries
17 entries across 17 versions & 1 rubygems