コード例 #1
0
        private static void UpdateOrInsert(
            Context context,
            LdapEntry entry,
            ParameterAccessor.Parts.Ldap ldap,
            DateTime synchronizedTime)
        {
            var deptCode = entry.Property(
                context: context,
                name: ldap.LdapDeptCode,
                pattern: ldap.LdapDeptCodePattern);
            var deptName = entry.Property(
                context: context,
                name: ldap.LdapDeptName,
                pattern: ldap.LdapDeptNamePattern);
            var userCode = entry.Property(
                context: context,
                name: ldap.LdapUserCode,
                pattern: ldap.LdapUserCodePattern);
            var loginId = LoginId(
                context: context,
                ldap: ldap,
                entry: entry);
            var name = Name(
                context: context,
                loginId: loginId,
                entry: entry,
                ldap: ldap);
            var mailAddress = entry.Property(
                context: context,
                name: ldap.LdapMailAddress,
                pattern: ldap.LdapMailAddressPattern);
            var attributes = ldap.LdapExtendedAttributes?
                             .Select(attribute =>
                                     new KeyValuePair <LdapExtendedAttribute, string>(
                                         attribute,
                                         entry.Property(
                                             context: context,
                                             name: attribute.Name,
                                             pattern: attribute.Pattern)))
                             .ToList();

            UpdateOrInsert(
                context: context,
                loginId: loginId,
                deptCode: deptCode,
                deptName: deptName,
                userCode: userCode,
                name: name,
                mailAddress: mailAddress,
                attributes: attributes,
                ldap: ldap,
                synchronizedTime: synchronizedTime);
        }
コード例 #2
0
 public static string NetBiosName(
     Context context, LdapEntry entry, ParameterAccessor.Parts.Ldap ldap)
 {
     return(ldap.NetBiosDomainName + "\\" + entry.Property(
                context: context,
                name: "sAMAccountName"));
 }
コード例 #3
0
        private static string Name(
            Context context,
            string loginId,
            LdapEntry entry,
            ParameterAccessor.Parts.Ldap ldap)
        {
            var name = "{0} {1}".Params(
                entry.Property(
                    context: context,
                    name: ldap.LdapLastName,
                    pattern: ldap.LdapLastNamePattern),
                entry.Property(
                    context: context,
                    name: ldap.LdapFirstName,
                    pattern: ldap.LdapFirstNamePattern));

            return(name != " "
                ? name.Trim()
                : loginId);
        }
コード例 #4
0
        private static string LoginId(
            Context context,
            ParameterAccessor.Parts.Ldap ldap,
            LdapEntry entry)
        {
            var loginId = Authentications.Windows(context: context)
                ? NetBiosName(
                context: context,
                entry: entry,
                ldap: ldap)
                : entry.Property(
                context: context,
                name: ldap.LdapSearchProperty);

            return(loginId);
        }