Sha256: 317fd921d7b7a35694ce63c3b02b705666f9c414bec7b99f1d843c4bf7dd5217
Contents?: true
Size: 607 Bytes
Versions: 3
Compression:
Stored size: 607 Bytes
Contents
# frozen_string_literal: true module Hydra module RoleManagement # Module offering methods for user behavior managing roles and groups module UserRoles extend ActiveSupport::Concern included do has_and_belongs_to_many :roles end def groups g = roles.map(&:name) g += ['registered'] unless new_record? || guest? g end def guest? if defined?(DeviseGuests) self[:guest] else false end end def admin? roles.where(name: 'admin').exists? end end end end
Version data entries
3 entries across 3 versions & 1 rubygems