本文整理汇总了C#中Principal.LoadValueIntoProperty方法的典型用法代码示例。如果您正苦于以下问题:C# Principal.LoadValueIntoProperty方法的具体用法?C# Principal.LoadValueIntoProperty怎么用?C# Principal.LoadValueIntoProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Principal
的用法示例。
在下文中一共展示了Principal.LoadValueIntoProperty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SamAccountNameFromWinNTConverter
private static void SamAccountNameFromWinNTConverter(DirectoryEntry de, string suggestedWinNTProperty, Principal p, string propertyName)
{
Debug.Assert(de.Properties["Name"].Count == 1);
string samAccountName = (string)de.Properties["Name"][0];
// string urnValue = p.Context.ConnectedServer + @"\" + samAccountName;
GlobalDebug.WriteLineIf(GlobalDebug.Info, "SAMStoreCtx", "SamAccountNameFromWinNTConverter: loading SAM{0}", samAccountName);
p.LoadValueIntoProperty(propertyName, (object)samAccountName);
}
示例2: GroupTypeFromWinNTConverter
private static void GroupTypeFromWinNTConverter(DirectoryEntry de, string suggestedWinNTProperty, Principal p, string propertyName)
{
// Groups are always enabled in SAM. There is no such thing as a distribution group.
p.LoadValueIntoProperty(PropertyNames.GroupIsSecurityGroup, (object)true);
if (propertyName == PropertyNames.GroupIsSecurityGroup)
{
// Do nothing for this property.
}
else
{
Debug.Assert(propertyName == PropertyNames.GroupGroupScope);
// All local machine SAM groups are local
#if DEBUG
PropertyValueCollection values = de.Properties[suggestedWinNTProperty];
if (values.Count != 0)
Debug.Assert(((int)values[0]) == 4);
#endif
p.LoadValueIntoProperty(propertyName, GroupScope.Local);
}
}
示例3: ElapsedTimeFromWinNTConverter
private static void ElapsedTimeFromWinNTConverter(DirectoryEntry de, string suggestedWinNTProperty, Principal p, string propertyName)
{
PropertyValueCollection item = de.Properties[suggestedWinNTProperty];
if (item.Count != 0)
{
int num = (int)item[0];
DateTime? nullable = new DateTime?(DateTime.UtcNow - new TimeSpan(0, 0, num));
p.LoadValueIntoProperty(propertyName, nullable);
}
}
示例4: SidFromWinNTConverter
private static void SidFromWinNTConverter(DirectoryEntry de, string suggestedWinNTProperty, Principal p, string propertyName)
{
byte[] sid = (byte[])de.Properties["objectSid"][0];
string stringizedSid = Utils.ByteArrayToString(sid);
string sddlSid = Utils.ConvertSidToSDDL(sid);
SecurityIdentifier SidObj = new SecurityIdentifier(sddlSid);
p.LoadValueIntoProperty(propertyName, (object)SidObj);
}
示例5: SidFromWinNTConverter
private static void SidFromWinNTConverter(DirectoryEntry de, string suggestedWinNTProperty, Principal p, string propertyName)
{
byte[] item = (byte[])de.Properties["objectSid"][0];
Utils.ByteArrayToString(item);
string sDDL = Utils.ConvertSidToSDDL(item);
SecurityIdentifier securityIdentifier = new SecurityIdentifier(sDDL);
p.LoadValueIntoProperty(propertyName, securityIdentifier);
}
示例6: DateFromWinNTConverter
private static void DateFromWinNTConverter(DirectoryEntry de, string suggestedWinNTProperty, Principal p, string propertyName)
{
PropertyValueCollection item = de.Properties[suggestedWinNTProperty];
if (item.Count != 0)
{
DateTime? nullable = (DateTime?)item[0];
p.LoadValueIntoProperty(propertyName, nullable);
}
}
示例7: GroupTypeFromWinNTConverter
private static void GroupTypeFromWinNTConverter(DirectoryEntry de, string suggestedWinNTProperty, Principal p, string propertyName)
{
p.LoadValueIntoProperty("GroupPrincipal.IsSecurityGroup", (bool)1);
if (propertyName != "GroupPrincipal.IsSecurityGroup")
{
p.LoadValueIntoProperty(propertyName, GroupScope.Local);
return;
}
else
{
return;
}
}
示例8: SidFromLdapConverter
//
// Conversion: LDAP --> PAPI
//
protected static void SidFromLdapConverter(dSPropertyCollection properties, string suggestedAdProperty, Principal p, string propertyName)
{
if (properties["objectSid"].Count > 0)
{
byte[] sid = (byte[])properties["objectSid"][0];
SecurityIdentifier SecurityId = new SecurityIdentifier(sid, 0);
p.LoadValueIntoProperty(propertyName, (object)SecurityId);
}
else
{
p.LoadValueIntoProperty(propertyName, null);
}
}
示例9: ObjectClassFromLdapConverter
protected static void ObjectClassFromLdapConverter(dSPropertyCollection properties, string suggestedAdProperty, Principal p, string propertyName)
{
dSPropertyValueCollection values = properties[suggestedAdProperty];
if (values.Count > 0)
{
// This is a multivalued attribute and we want the last element. The most specialized object class...
Debug.Assert(values[values.Count - 1] is string);
p.LoadValueIntoProperty(propertyName, (string)values[values.Count - 1]);
}
}
示例10: DateTimeFromLdapConverter
protected static void DateTimeFromLdapConverter(dSPropertyCollection properties, string suggestedAdProperty, Principal p, string propertyName, bool useAcctExpLogic)
{
dSPropertyValueCollection values = properties[suggestedAdProperty];
if (values.Count != 0)
{
Debug.Assert(values.Count == 1);
Int64 filetime;
if (values[0] is Int64)
filetime = (Int64)values[0];
else
filetime = ADUtils.LargeIntToInt64((UnsafeNativeMethods.IADsLargeInteger)values[0]);
Nullable<DateTime> dt;
// Filetimes use "0" to mean "no value, except for accountExpires,
// which uses both "0" and "0x7fffffffffffffff" to mean "no expiration date"
if ((!useAcctExpLogic) && (filetime == 0x0))
dt = null;
else if ((useAcctExpLogic) && (filetime == 0x0 || filetime == 0x7fffffffffffffff))
dt = null;
else
dt = ADUtils.ADFileTimeToDateTime(filetime);
p.LoadValueIntoProperty(propertyName, dt);
}
}
示例11: CommaStringFromLdapConverter
protected static void CommaStringFromLdapConverter(dSPropertyCollection properties, string suggestedAdProperty, Principal p, string propertyName)
{
Debug.Assert(String.Compare(suggestedAdProperty, "userWorkstations", StringComparison.OrdinalIgnoreCase) == 0);
// The userWorkstations attribute is odd. Rather than being a multivalued string attribute, it's a single-valued
// string of comma-separated values.
dSPropertyValueCollection values = properties[suggestedAdProperty];
if (values.Count != 0)
{
Debug.Assert(values.Count == 1);
Debug.Assert(values[0] is string);
string commaSeparatedValues = (string)values[0];
string[] individualValues = commaSeparatedValues.Split(new char[] { ',' });
// ValueCollection<string> is Load'ed from a List<string>
List<string> list = new List<string>(individualValues.Length);
foreach (string s in individualValues)
{
list.Add(s);
}
p.LoadValueIntoProperty(propertyName, list);
}
}
示例12: AcctDisabledFromLdapConverter
// This function is converting the disabled directory status into the enabled principal property
// the boolan value needs to be negated
protected static void AcctDisabledFromLdapConverter(dSPropertyCollection properties, string suggestedAdProperty, Principal p, string propertyName)
{
if (properties[suggestedAdProperty].Count > 0)
{
// We're intended to handle single-valued scalar properties
Debug.Assert(properties[suggestedAdProperty].Count == 1);
Debug.Assert(properties[suggestedAdProperty][0] is bool);
p.LoadValueIntoProperty(propertyName, !(bool)properties[suggestedAdProperty][0]);
}
}
示例13: GuidFromLdapConverter
protected static void GuidFromLdapConverter(dSPropertyCollection properties, string suggestedAdProperty, Principal p, string propertyName)
{
Debug.Assert(properties["objectGuid"].Count == 1);
if (properties["objectGuid"].Count == 1)
{
byte[] guid = (byte[])properties["objectGuid"][0];
Guid g = new Guid(guid);
p.LoadValueIntoProperty(propertyName, g);
}
else
{
p.LoadValueIntoProperty(propertyName, null);
}
}
示例14: ElapsedTimeFromWinNTConverter
private static void ElapsedTimeFromWinNTConverter(DirectoryEntry de, string suggestedWinNTProperty, Principal p, string propertyName)
{
// These properties are expressed as "seconds passed since the event of interest". So to convert
// to a DateTime, we substract them from DateTime.UtcNow.
PropertyValueCollection values = de.Properties[suggestedWinNTProperty];
if (values.Count != 0)
{
// We're intended to handle single-valued scalar properties
Debug.Assert(values.Count == 1);
Debug.Assert(values[0] is Int32);
int secondsLapsed = (int)values[0];
Nullable<DateTime> dt = DateTime.UtcNow - new TimeSpan(0, 0, secondsLapsed);
p.LoadValueIntoProperty(propertyName, dt);
}
}
示例15: SamAccountNameFromWinNTConverter
private static void SamAccountNameFromWinNTConverter(DirectoryEntry de, string suggestedWinNTProperty, Principal p, string propertyName)
{
string item = (string)de.Properties["Name"][0];
p.LoadValueIntoProperty(propertyName, item);
}