module DeviseLdapUac

Constants

PROPERTY_FLAGS

Based on this KB article support.microsoft.com/kb/305144

VERSION

Public Instance Methods

uac_flagged() click to toggle source
# File lib/devise_ldap_uac.rb, line 31
def uac_flagged
  check_bitmask
  DeviseLdapUac::PROPERTY_FLAGS.reject do |r|
    ((ldap_uac || 0) & 2**DeviseLdapUac::PROPERTY_FLAGS.index(r)).zero?
  end
end
uac_unflagged() click to toggle source
# File lib/devise_ldap_uac.rb, line 38
def uac_unflagged
  check_bitmask
  DeviseLdapUac::PROPERTY_FLAGS.keep_if do |r|
    ((ldap_uac || 0) & 2**DeviseLdapUac::PROPERTY_FLAGS.index(r)).zero?
  end
end

Private Instance Methods

check_bitmask() click to toggle source
# File lib/devise_ldap_uac.rb, line 53
def check_bitmask
  if !ldap_uac.is_a?(Integer) || ldap_uac.to_i.zero?
    raise ArgumentError, "Bitmask is not an Integer"
  end
end
ldap_uac() click to toggle source
# File lib/devise_ldap_uac.rb, line 47
def ldap_uac
  Devise::LDAP::Adapter.get_ldap_param(
    self.login, "userAccountControl"
  ).first.to_i
end