Sha256: 8d4f7d3e48821adb823b7bcdfbd185e069b3403dfc3e425e2a9d17af76d5f089

Contents?: true

Size: 383 Bytes

Versions: 3

Compression:

Stored size: 383 Bytes

Contents

module Hydra
  module RoleManagement
    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 admin?
        roles.where(name: 'admin').exists?
      end
      
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hydra-role-management-0.1.0 app/models/concerns/hydra/role_management/user_roles.rb
hydra-role-management-0.0.2 app/models/concerns/hydra/role_management/user_roles.rb
hydra-role-management-0.0.1 app/models/concerns/hydra/role_management/user_roles.rb