2022-03-08 05:37:20 +00:00
|
|
|
|
/*
|
|
|
|
|
*
|
|
|
|
|
* (c) Copyright Ascensio System Limited 2010-2021
|
|
|
|
|
*
|
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
|
* limitations under the License.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
namespace ASC.ActiveDirectory.Base.Settings;
|
|
|
|
|
[Scope]
|
|
|
|
|
[Serializable]
|
|
|
|
|
[DataContract]
|
|
|
|
|
public class LdapSettings : ISettings, ICloneable
|
2022-03-08 05:37:20 +00:00
|
|
|
|
{
|
2022-03-17 19:44:34 +00:00
|
|
|
|
public Guid ID
|
2022-03-08 05:37:20 +00:00
|
|
|
|
{
|
2022-03-17 19:44:34 +00:00
|
|
|
|
get { return new Guid("{197149b3-fbc9-44c2-b42a-232f7e729c16}"); }
|
|
|
|
|
}
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-04-08 10:44:18 +00:00
|
|
|
|
public LdapSettings()
|
2022-03-17 19:44:34 +00:00
|
|
|
|
{
|
|
|
|
|
LdapMapping = new Dictionary<MappingFields, string>();
|
|
|
|
|
AccessRights = new Dictionary<AccessRight, string>();
|
|
|
|
|
}
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
public enum MappingFields
|
|
|
|
|
{
|
|
|
|
|
FirstNameAttribute,
|
|
|
|
|
SecondNameAttribute,
|
|
|
|
|
BirthDayAttribute,
|
|
|
|
|
GenderAttribute,
|
|
|
|
|
MobilePhoneAttribute,
|
|
|
|
|
MailAttribute,
|
|
|
|
|
TitleAttribute,
|
|
|
|
|
LocationAttribute,
|
|
|
|
|
AvatarAttribute,
|
|
|
|
|
|
|
|
|
|
AdditionalPhone,
|
|
|
|
|
AdditionalMobilePhone,
|
|
|
|
|
AdditionalMail,
|
|
|
|
|
Skype
|
|
|
|
|
}
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
public enum AccessRight
|
|
|
|
|
{
|
|
|
|
|
FullAccess,
|
|
|
|
|
Documents,
|
|
|
|
|
Projects,
|
|
|
|
|
CRM,
|
|
|
|
|
Community,
|
|
|
|
|
People,
|
|
|
|
|
Mail
|
|
|
|
|
}
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
public static readonly Dictionary<AccessRight, Guid> AccessRightsGuids = new Dictionary<AccessRight, Guid>()
|
2022-03-08 05:37:20 +00:00
|
|
|
|
{
|
|
|
|
|
{ AccessRight.FullAccess, Guid.Empty },
|
|
|
|
|
{ AccessRight.Documents, WebItemManager.DocumentsProductID },
|
|
|
|
|
{ AccessRight.Projects, WebItemManager.ProjectsProductID },
|
|
|
|
|
{ AccessRight.CRM, WebItemManager.CRMProductID },
|
|
|
|
|
{ AccessRight.Community, WebItemManager.CommunityProductID },
|
|
|
|
|
{ AccessRight.People, WebItemManager.PeopleProductID },
|
|
|
|
|
{ AccessRight.Mail, WebItemManager.MailProductID }
|
|
|
|
|
};
|
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
public ISettings GetDefault(IServiceProvider serviceProvider)
|
|
|
|
|
{
|
|
|
|
|
var isMono = WorkContext.IsMono;
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-04-08 10:44:18 +00:00
|
|
|
|
var settings = new LdapSettings()
|
2022-03-17 19:44:34 +00:00
|
|
|
|
{
|
|
|
|
|
Server = "",
|
|
|
|
|
UserDN = "",
|
|
|
|
|
PortNumber = LdapConstants.STANDART_LDAP_PORT,
|
|
|
|
|
UserFilter = string.Format("({0}=*)",
|
|
|
|
|
isMono
|
2022-03-08 05:37:20 +00:00
|
|
|
|
? LdapConstants.RfcLDAPAttributes.UID
|
2022-03-17 19:44:34 +00:00
|
|
|
|
: LdapConstants.ADSchemaAttributes.USER_PRINCIPAL_NAME),
|
|
|
|
|
LoginAttribute = isMono
|
|
|
|
|
? LdapConstants.RfcLDAPAttributes.UID
|
|
|
|
|
: LdapConstants.ADSchemaAttributes.ACCOUNT_NAME,
|
|
|
|
|
FirstNameAttribute = LdapConstants.ADSchemaAttributes.FIRST_NAME,
|
|
|
|
|
SecondNameAttribute = LdapConstants.ADSchemaAttributes.SURNAME,
|
|
|
|
|
MailAttribute = LdapConstants.ADSchemaAttributes.MAIL,
|
|
|
|
|
TitleAttribute = LdapConstants.ADSchemaAttributes.TITLE,
|
|
|
|
|
MobilePhoneAttribute = LdapConstants.ADSchemaAttributes.MOBILE,
|
|
|
|
|
LocationAttribute = LdapConstants.ADSchemaAttributes.STREET,
|
|
|
|
|
GroupDN = "",
|
|
|
|
|
GroupFilter = string.Format("({0}={1})", LdapConstants.ADSchemaAttributes.OBJECT_CLASS,
|
|
|
|
|
isMono
|
|
|
|
|
? LdapConstants.ObjectClassKnowedValues.POSIX_GROUP
|
|
|
|
|
: LdapConstants.ObjectClassKnowedValues.GROUP),
|
|
|
|
|
UserAttribute =
|
|
|
|
|
isMono
|
|
|
|
|
? LdapConstants.RfcLDAPAttributes.UID
|
|
|
|
|
: LdapConstants.ADSchemaAttributes.DISTINGUISHED_NAME,
|
|
|
|
|
GroupAttribute = isMono ? LdapConstants.RfcLDAPAttributes.MEMBER_UID : LdapConstants.ADSchemaAttributes.MEMBER,
|
|
|
|
|
GroupNameAttribute = LdapConstants.ADSchemaAttributes.COMMON_NAME,
|
|
|
|
|
Authentication = true,
|
|
|
|
|
AcceptCertificate = false,
|
|
|
|
|
AcceptCertificateHash = null,
|
|
|
|
|
StartTls = false,
|
|
|
|
|
Ssl = false,
|
|
|
|
|
SendWelcomeEmail = false
|
|
|
|
|
};
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
return settings;
|
|
|
|
|
}
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
public override bool Equals(object obj)
|
|
|
|
|
{
|
|
|
|
|
var settings = obj as LdapSettings;
|
|
|
|
|
|
|
|
|
|
return settings != null
|
|
|
|
|
&& EnableLdapAuthentication == settings.EnableLdapAuthentication
|
|
|
|
|
&& StartTls == settings.StartTls
|
|
|
|
|
&& Ssl == settings.Ssl
|
|
|
|
|
&& SendWelcomeEmail == settings.SendWelcomeEmail
|
|
|
|
|
&& (string.IsNullOrEmpty(Server)
|
|
|
|
|
&& string.IsNullOrEmpty(settings.Server)
|
|
|
|
|
|| Server == settings.Server)
|
|
|
|
|
&& (string.IsNullOrEmpty(UserDN)
|
|
|
|
|
&& string.IsNullOrEmpty(settings.UserDN)
|
|
|
|
|
|| UserDN == settings.UserDN)
|
|
|
|
|
&& PortNumber == settings.PortNumber
|
|
|
|
|
&& UserFilter == settings.UserFilter
|
|
|
|
|
&& LoginAttribute == settings.LoginAttribute
|
|
|
|
|
&& LdapMapping.Count == settings.LdapMapping.Count
|
|
|
|
|
&& LdapMapping.All(pair => settings.LdapMapping.ContainsKey(pair.Key)
|
|
|
|
|
&& pair.Value == settings.LdapMapping[pair.Key])
|
|
|
|
|
&& AccessRights.Count == settings.AccessRights.Count
|
|
|
|
|
&& AccessRights.All(pair => settings.AccessRights.ContainsKey(pair.Key)
|
|
|
|
|
&& pair.Value == settings.AccessRights[pair.Key])
|
|
|
|
|
&& GroupMembership == settings.GroupMembership
|
|
|
|
|
&& (string.IsNullOrEmpty(GroupDN)
|
|
|
|
|
&& string.IsNullOrEmpty(settings.GroupDN)
|
|
|
|
|
|| GroupDN == settings.GroupDN)
|
|
|
|
|
&& GroupFilter == settings.GroupFilter
|
|
|
|
|
&& UserAttribute == settings.UserAttribute
|
|
|
|
|
&& GroupAttribute == settings.GroupAttribute
|
|
|
|
|
&& (string.IsNullOrEmpty(Login)
|
|
|
|
|
&& string.IsNullOrEmpty(settings.Login)
|
|
|
|
|
|| Login == settings.Login)
|
|
|
|
|
&& Authentication == settings.Authentication;
|
|
|
|
|
}
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
public override int GetHashCode()
|
|
|
|
|
{
|
|
|
|
|
var hash = 3;
|
|
|
|
|
hash = (hash * 2) + EnableLdapAuthentication.GetHashCode();
|
|
|
|
|
hash = (hash * 2) + StartTls.GetHashCode();
|
|
|
|
|
hash = (hash * 2) + Ssl.GetHashCode();
|
|
|
|
|
hash = (hash * 2) + SendWelcomeEmail.GetHashCode();
|
|
|
|
|
hash = (hash * 2) + Server.GetHashCode();
|
|
|
|
|
hash = (hash * 2) + UserDN.GetHashCode();
|
|
|
|
|
hash = (hash * 2) + PortNumber.GetHashCode();
|
|
|
|
|
hash = (hash * 2) + UserFilter.GetHashCode();
|
|
|
|
|
hash = (hash * 2) + LoginAttribute.GetHashCode();
|
|
|
|
|
hash = (hash * 2) + GroupMembership.GetHashCode();
|
|
|
|
|
hash = (hash * 2) + GroupDN.GetHashCode();
|
|
|
|
|
hash = (hash * 2) + GroupNameAttribute.GetHashCode();
|
|
|
|
|
hash = (hash * 2) + GroupFilter.GetHashCode();
|
|
|
|
|
hash = (hash * 2) + UserAttribute.GetHashCode();
|
|
|
|
|
hash = (hash * 2) + GroupAttribute.GetHashCode();
|
|
|
|
|
hash = (hash * 2) + Authentication.GetHashCode();
|
|
|
|
|
hash = (hash * 2) + Login.GetHashCode();
|
|
|
|
|
|
|
|
|
|
foreach (var pair in LdapMapping)
|
|
|
|
|
hash = (hash * 2) + pair.Value.GetHashCode();
|
|
|
|
|
|
|
|
|
|
foreach (var pair in AccessRights)
|
|
|
|
|
hash = (hash * 2) + pair.Value.GetHashCode();
|
|
|
|
|
|
|
|
|
|
return hash;
|
|
|
|
|
}
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
public object Clone()
|
|
|
|
|
{
|
|
|
|
|
return MemberwiseClone();
|
|
|
|
|
}
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
[DataMember]
|
|
|
|
|
public bool EnableLdapAuthentication { get; set; }
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
[DataMember]
|
|
|
|
|
public bool StartTls { get; set; }
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
[DataMember]
|
|
|
|
|
public bool Ssl { get; set; }
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
[DataMember]
|
|
|
|
|
public bool SendWelcomeEmail { get; set; }
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
[DataMember]
|
|
|
|
|
public string Server { get; set; }
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
[DataMember]
|
|
|
|
|
// ReSharper disable once InconsistentNaming
|
|
|
|
|
public string UserDN { get; set; }
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
[DataMember]
|
|
|
|
|
public int PortNumber { get; set; }
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
[DataMember]
|
|
|
|
|
public string UserFilter { get; set; }
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
[DataMember]
|
|
|
|
|
public string LoginAttribute { get; set; }
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
[DataMember]
|
|
|
|
|
public Dictionary<MappingFields, string> LdapMapping { get; set; }
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
//ToDo: use SId instead of group name
|
|
|
|
|
[DataMember]
|
|
|
|
|
public Dictionary<AccessRight, string> AccessRights { get; set; }
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
[DataMember]
|
|
|
|
|
public string FirstNameAttribute
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return GetOldSetting(MappingFields.FirstNameAttribute);
|
2022-03-08 05:37:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
set
|
2022-03-08 05:37:20 +00:00
|
|
|
|
{
|
2022-03-17 19:44:34 +00:00
|
|
|
|
SetOldSetting(MappingFields.FirstNameAttribute, value);
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
[DataMember]
|
|
|
|
|
public string SecondNameAttribute
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return GetOldSetting(MappingFields.SecondNameAttribute);
|
2022-03-08 05:37:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
set
|
2022-03-08 05:37:20 +00:00
|
|
|
|
{
|
2022-03-17 19:44:34 +00:00
|
|
|
|
SetOldSetting(MappingFields.SecondNameAttribute, value);
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
[DataMember]
|
|
|
|
|
public string MailAttribute
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return GetOldSetting(MappingFields.MailAttribute);
|
2022-03-08 05:37:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
set
|
2022-03-08 05:37:20 +00:00
|
|
|
|
{
|
2022-03-17 19:44:34 +00:00
|
|
|
|
SetOldSetting(MappingFields.MailAttribute, value);
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
[DataMember]
|
|
|
|
|
public string TitleAttribute
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return GetOldSetting(MappingFields.TitleAttribute);
|
2022-03-08 05:37:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
set
|
2022-03-08 05:37:20 +00:00
|
|
|
|
{
|
2022-03-17 19:44:34 +00:00
|
|
|
|
SetOldSetting(MappingFields.TitleAttribute, value);
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
[DataMember]
|
|
|
|
|
public string MobilePhoneAttribute
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return GetOldSetting(MappingFields.MobilePhoneAttribute);
|
2022-03-08 05:37:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
set
|
2022-03-08 05:37:20 +00:00
|
|
|
|
{
|
2022-03-17 19:44:34 +00:00
|
|
|
|
SetOldSetting(MappingFields.MobilePhoneAttribute, value);
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
[DataMember]
|
|
|
|
|
public string LocationAttribute
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return GetOldSetting(MappingFields.LocationAttribute);
|
2022-03-08 05:37:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
SetOldSetting(MappingFields.LocationAttribute, value);
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
[DataMember]
|
|
|
|
|
public bool GroupMembership { get; set; }
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
[DataMember]
|
|
|
|
|
// ReSharper disable once InconsistentNaming
|
|
|
|
|
public string GroupDN { get; set; }
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
[DataMember]
|
|
|
|
|
public string GroupNameAttribute { get; set; }
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
[DataMember]
|
|
|
|
|
public string GroupFilter { get; set; }
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
[DataMember]
|
|
|
|
|
public string UserAttribute { get; set; }
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
[DataMember]
|
|
|
|
|
public string GroupAttribute { get; set; }
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
[DataMember]
|
|
|
|
|
public bool Authentication { get; set; }
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
[DataMember]
|
|
|
|
|
public string Login { get; set; }
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
[DataMember]
|
|
|
|
|
public string Password { get; set; }
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
[DataMember]
|
|
|
|
|
public byte[] PasswordBytes { get; set; }
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
[DataMember]
|
|
|
|
|
public bool IsDefault { get; set; }
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
[DataMember]
|
|
|
|
|
public bool AcceptCertificate { get; set; }
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
[DataMember]
|
|
|
|
|
public string AcceptCertificateHash { get; set; }
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
private string GetOldSetting(MappingFields field)
|
|
|
|
|
{
|
|
|
|
|
if (LdapMapping == null)
|
|
|
|
|
LdapMapping = new Dictionary<MappingFields, string>();
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
if (LdapMapping.ContainsKey(field))
|
|
|
|
|
return LdapMapping[field];
|
|
|
|
|
else
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
private void SetOldSetting(MappingFields field, string value)
|
|
|
|
|
{
|
|
|
|
|
if (LdapMapping == null)
|
|
|
|
|
LdapMapping = new Dictionary<MappingFields, string>();
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
if (string.IsNullOrEmpty(value))
|
|
|
|
|
{
|
2022-03-08 05:37:20 +00:00
|
|
|
|
if (LdapMapping.ContainsKey(field))
|
|
|
|
|
{
|
2022-03-17 19:44:34 +00:00
|
|
|
|
LdapMapping.Remove(field);
|
2022-03-08 05:37:20 +00:00
|
|
|
|
}
|
2022-03-17 19:44:34 +00:00
|
|
|
|
return;
|
2022-03-08 05:37:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
if (LdapMapping.ContainsKey(field))
|
2022-03-08 05:37:20 +00:00
|
|
|
|
{
|
2022-03-17 19:44:34 +00:00
|
|
|
|
LdapMapping[field] = value;
|
2022-03-08 05:37:20 +00:00
|
|
|
|
}
|
2022-03-17 19:44:34 +00:00
|
|
|
|
else
|
2022-03-08 05:37:20 +00:00
|
|
|
|
{
|
2022-03-17 19:44:34 +00:00
|
|
|
|
LdapMapping.Add(field, value);
|
2022-03-08 05:37:20 +00:00
|
|
|
|
}
|
2022-03-17 19:44:34 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
[Scope]
|
|
|
|
|
[Serializable]
|
|
|
|
|
[DataContract]
|
|
|
|
|
public class LdapCronSettings : ISettings
|
|
|
|
|
{
|
|
|
|
|
public Guid ID
|
|
|
|
|
{
|
|
|
|
|
get { return new Guid("{58C42C54-56CD-4BEF-A3ED-C60ACCF6E975}"); }
|
2022-03-08 05:37:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
public ISettings GetDefault(IServiceProvider serviceProvider)
|
2022-03-08 05:37:20 +00:00
|
|
|
|
{
|
2022-03-17 19:44:34 +00:00
|
|
|
|
return new LdapCronSettings()
|
2022-03-08 05:37:20 +00:00
|
|
|
|
{
|
2022-03-17 19:44:34 +00:00
|
|
|
|
Cron = null
|
|
|
|
|
};
|
|
|
|
|
}
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
[DataMember]
|
|
|
|
|
public string Cron { get; set; }
|
|
|
|
|
}
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
[Serializable]
|
|
|
|
|
[DataContract]
|
|
|
|
|
public class LdapCurrentAcccessSettings : ISettings
|
|
|
|
|
{
|
|
|
|
|
public Guid ID
|
|
|
|
|
{
|
|
|
|
|
get { return new Guid("{134B5EAA-F612-4834-AEAB-34C90515EA4E}"); }
|
|
|
|
|
}
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
public ISettings GetDefault(IServiceProvider serviceProvider)
|
|
|
|
|
{
|
|
|
|
|
return new LdapCurrentAcccessSettings() { CurrentAccessRights = null };
|
2022-03-08 05:37:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
public LdapCurrentAcccessSettings()
|
2022-03-08 05:37:20 +00:00
|
|
|
|
{
|
2022-03-17 19:44:34 +00:00
|
|
|
|
CurrentAccessRights = new Dictionary<LdapSettings.AccessRight, List<string>>();
|
|
|
|
|
}
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
[DataMember]
|
|
|
|
|
public Dictionary<LdapSettings.AccessRight, List<string>> CurrentAccessRights { get; set; }
|
|
|
|
|
}
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
[Serializable]
|
|
|
|
|
[DataContract]
|
|
|
|
|
public class LdapCurrentUserPhotos : ISettings
|
|
|
|
|
{
|
|
|
|
|
public Guid ID
|
|
|
|
|
{
|
|
|
|
|
get { return new Guid("{50AE3C2B-0783-480F-AF30-679D0F0A2D3E}"); }
|
|
|
|
|
}
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
public ISettings GetDefault(IServiceProvider serviceProvider)
|
|
|
|
|
{
|
|
|
|
|
return new LdapCurrentUserPhotos() { CurrentPhotos = null };
|
2022-03-08 05:37:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
public LdapCurrentUserPhotos()
|
2022-03-08 05:37:20 +00:00
|
|
|
|
{
|
2022-03-17 19:44:34 +00:00
|
|
|
|
CurrentPhotos = new Dictionary<Guid, string>();
|
|
|
|
|
}
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
[DataMember]
|
|
|
|
|
public Dictionary<Guid, string> CurrentPhotos { get; set; }
|
|
|
|
|
}
|
2022-03-08 05:37:20 +00:00
|
|
|
|
|
2022-03-17 19:44:34 +00:00
|
|
|
|
[Serializable]
|
|
|
|
|
[DataContract]
|
|
|
|
|
public class LdapCurrentDomain : ISettings
|
|
|
|
|
{
|
|
|
|
|
public Guid ID
|
|
|
|
|
{
|
|
|
|
|
get { return new Guid("{75A5F745-F697-4418-B38D-0FE0D277E258}"); }
|
2022-03-08 05:37:20 +00:00
|
|
|
|
}
|
2022-03-17 19:44:34 +00:00
|
|
|
|
|
|
|
|
|
public ISettings GetDefault(IServiceProvider serviceProvider)
|
|
|
|
|
{
|
|
|
|
|
return new LdapCurrentDomain() { CurrentDomain = null };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[DataMember]
|
|
|
|
|
public string CurrentDomain { get; set; }
|
2022-03-08 05:37:20 +00:00
|
|
|
|
}
|