Sha256: eaf3a22ad2ca40a931de9aafc281e05dc78f68ed5fd8f9da3713ac9bf5f31c1c

Contents?: true

Size: 563 Bytes

Versions: 14

Compression:

Stored size: 563 Bytes

Contents

require_dependency 'egov_utils/auth_source'
module EgovUtils
  class Group < Principal
    validates :name, presence: true, uniqueness: true
    validates :ldap_uid, uniqueness: true, allow_nil: true

    def members

    end

    def ldap_members
      Rails.cache.fetch("#{cache_key}/ldap_members", expires_in: 2.hours) do
        if provider.present?
          auth_source.group_members(ldap_uid)
        else
          []
        end
      end
    end

    def ldap_member?(user)
      ldap_members.detect{|mem| mem[:login] == user.login }
    end

  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
egov_utils-0.1.15 app/models/egov_utils/group.rb
egov_utils-0.1.14 app/models/egov_utils/group.rb
egov_utils-0.1.13 app/models/egov_utils/group.rb
egov_utils-0.1.12 app/models/egov_utils/group.rb
egov_utils-0.1.11 app/models/egov_utils/group.rb
egov_utils-0.1.10 app/models/egov_utils/group.rb
egov_utils-0.1.9 app/models/egov_utils/group.rb
egov_utils-0.1.8 app/models/egov_utils/group.rb
egov_utils-0.1.7 app/models/egov_utils/group.rb
egov_utils-0.1.6 app/models/egov_utils/group.rb
egov_utils-0.1.5 app/models/egov_utils/group.rb
egov_utils-0.1.4 app/models/egov_utils/group.rb
egov_utils-0.1.1 app/models/egov_utils/group.rb
egov_utils-0.1.0 app/models/egov_utils/group.rb