app/models/egov_utils/group.rb in egov_utils-0.1.18 vs app/models/egov_utils/group.rb in egov_utils-0.1.19

- old
+ new

@@ -2,10 +2,14 @@ module EgovUtils class Group < Principal validates :name, presence: true, uniqueness: true validates :ldap_uid, uniqueness: true, allow_nil: true + def self.organizations_by_domains(domains) + EgovUtils::Organization.where(domain: domains) + end + def members end def ldap_members @@ -21,10 +25,14 @@ def ldap_member?(user) ldap_members.detect{|mem| mem[:login] == user.login } end def external_uid - super || auth_source.send(:get_group_dn, sid: ldap_uid) + super || ( ldap? && ldap_uid && auth_source.send(:get_group_dn, sid: ldap_uid) ) + end + + def ldap_dn + ldap? && external_uid end end end