本文整理汇总了C#中Services.GetACLs方法的典型用法代码示例。如果您正苦于以下问题:C# Services.GetACLs方法的具体用法?C# Services.GetACLs怎么用?C# Services.GetACLs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Services
的用法示例。
在下文中一共展示了Services.GetACLs方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckAccessFromUserNameImp
internal static bool CheckAccessFromUserNameImp(Services.Packages.Log.ApplicationException _object, string userName, string securityDescriptor)
{
if (!ApplicationExceptionSecureService.IsSecurableImp)
return true;
// Owner can do anything
if (CheckUserRightsImp(userName, "Owner"))
return true;
// User could have constant rights on the class
if (CheckUserRightsImp(userName, securityDescriptor + " " + typeof(Services.Packages.Log.ApplicationException).FullName))
return true;
if (_object.Owner != null && _object.Owner.Name == userName)
return true;
ApplicationExceptionAccessControlListCollection acls = _object.GetACLs(userName);
if (acls.Count == 0)
{
if (userName.ToLowerInvariant() != "everyone")
return CheckAccessFromUserNameImp(_object, "Everyone", securityDescriptor);
else return false;
}
ApplicationExceptionAccessControlList acl = acls[0];
ApplicationExceptionAccessControlEntryCollection entries = ApplicationExceptionAccessControlEntry.GetEntries(securityDescriptor.ToLowerInvariant(), acl);
if (entries.Count == 0)
{
// Descriptor missing; Add-it
ApplicationExceptionAccessControlEntry entry = new ApplicationExceptionAccessControlEntry();
entry.Descriptor = securityDescriptor.ToLowerInvariant();
entry.UserName = userName;
entry.Allow = false;
entry.ACL = acl;
entry.Create();
return false;
}
if (!entries[0].Allow)
{
if (userName.ToLowerInvariant() != "everyone")
return CheckAccessFromUserNameImp(_object, "Everyone", securityDescriptor);
else return false;
}
return true;
}
开发者ID:phaetto,项目名称:services-update,代码行数:48,代码来源:Services.Packages.Log.Security.ApplicationExceptionSecureService.cs
示例2: ChangeAccessImp
internal static void ChangeAccessImp(Services.Packages.Log.ApplicationException _object, string userName, string securityDescriptor, bool allow, string SessionToken)
{
// Check if user can do that
ModelSession session = CheckSessionImp(SessionToken);
if (CheckAccessImp(_object, SessionToken, "ChangeAccess"))
{
try
{
ApplicationExceptionAccessControlListCollection acls = _object.GetACLs(userName);
ApplicationExceptionAccessControlList acl;
if (acls.Count == 0)
{
acl = new ApplicationExceptionAccessControlList();
acl.UserName = userName;
acl.ApplicationException = _object;
acl.Create();
}
else
{
acl = acls[0];
}
ApplicationExceptionAccessControlEntry entry = new ApplicationExceptionAccessControlEntry();
entry.Descriptor = securityDescriptor.ToLowerInvariant();
entry.UserName = userName;
entry.Allow = allow;
entry.ACL = acl;
entry.Create();
return;
}
catch
{
}
}
throw new UnauthorizedAccessException("Access Denied");
}
开发者ID:phaetto,项目名称:services-update,代码行数:40,代码来源:Services.Packages.Log.Security.ApplicationExceptionSecureService.cs