本文整理汇总了C#中ModelUser.Delete方法的典型用法代码示例。如果您正苦于以下问题:C# ModelUser.Delete方法的具体用法?C# ModelUser.Delete怎么用?C# ModelUser.Delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelUser
的用法示例。
在下文中一共展示了ModelUser.Delete方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeleteUserImp
internal static void DeleteUserImp(string userName, string SessionToken)
{
if (String.IsNullOrEmpty(userName))
{
throw new InvalidOperationException("One of the requested fields is empty.");
}
if (userName.ToLowerInvariant() == "everyone")
throw new InvalidOperationException("Anonymous user delete is not allowed.");
ModelSession session = CheckSessionImp(SessionToken);
if (CheckUserRightsImp(session.User.Name, "ManageUsers"))
{
ModelUser mu = new ModelUser(userName);
if (!mu.Exists)
throw new InvalidOperationException("User does not exist.");
mu.Delete();
return;
}
throw new UnauthorizedAccessException("Access Denied");
}
开发者ID:phaetto,项目名称:services-update,代码行数:26,代码来源:Services.Packages.Log.Security.ApplicationExceptionSecureService.cs
示例2: DeleteObject
public void DeleteObject(ModelUser _ModelUser, string SessionToken)
{
if (!ModelUserSecureService.CheckAccessImp(_ModelUser, SessionToken, "Delete"))
throw new UnauthorizedAccessException("Access Denied");
_ModelUser.Delete();
}
开发者ID:phaetto,项目名称:services-update,代码行数:7,代码来源:Services.Packages.Security.Security.ModelUserSecureService.cs