Sha256: b1473b1caadaed7ed58f76a434317ef96d592dc5c8140ffefe86afa31f973010

Contents?: true

Size: 570 Bytes

Versions: 11

Compression:

Stored size: 570 Bytes

Contents

##
# This is the class of all Groups. A Group is a role that does not depend
# on context, but rather on membership - a user can be made a member
# of such a role. This might be related to that person's role in the
# organization, for example.
module Arrthorizer
  class Group < Role
    attr_reader :name

    def initialize(name)
      @name = name

      Role.register(self)
    end

    def applies_to_user?(user, _)
      is_member?(user)
    end

  private
    def is_member?(user)
      Arrthorizer.membership_service.is_member_of?(user, self)
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
arrthorizer-0.4.2 lib/arrthorizer/group.rb
arrthorizer-0.4.1 lib/arrthorizer/group.rb
arrthorizer-0.3.2 lib/arrthorizer/group.rb
arrthorizer-0.3.1 lib/arrthorizer/group.rb
arrthorizer-0.3.0 lib/arrthorizer/group.rb
arrthorizer-0.2.1 lib/arrthorizer/group.rb
arrthorizer-0.2.0 lib/arrthorizer/group.rb
arrthorizer-0.1.3 lib/arrthorizer/group.rb
arrthorizer-0.1.2 lib/arrthorizer/group.rb
arrthorizer-0.1.1 lib/arrthorizer/group.rb
arrthorizer-0.1.0 lib/arrthorizer/group.rb