本文整理汇总了C#中ModelUser类的典型用法代码示例。如果您正苦于以下问题:C# ModelUser类的具体用法?C# ModelUser怎么用?C# ModelUser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ModelUser类属于命名空间,在下文中一共展示了ModelUser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetACLs
public Services.Packages.Security.Security.ModelUserAccessControlListCollection GetACLs(ModelUser _ModelUser, string SessionToken)
{
object[] results = this.Invoke("GetACLs", new object[] {_ModelUser,SessionToken});
return ((Services.Packages.Security.Security.ModelUserAccessControlListCollection)(results[0]));
}
开发者ID:phaetto,项目名称:services-update,代码行数:5,代码来源:Services.Packages.Security.Security.ModelUserSecureService.cs
示例2: SetUserByObject
public void SetUserByObject(ModelUser userObject, string SessionToken)
{
ApplicationExceptionSecureService.SetUserByObjectImp(userObject, SessionToken);
}
开发者ID:phaetto,项目名称:services-update,代码行数:4,代码来源:Services.Packages.Log.Security.ApplicationExceptionSecureService.cs
示例3: ModelReEstablishResilientOpenRequest
public ModelReEstablishResilientOpenRequest(ModelUser user)
: base(0)
{
User = user;
}
示例4: SetupImp
internal static void SetupImp()
{
ModelUser mu = new ModelUser("Everyone");
if (!mu.Exists)
{
mu.PasswordHash = null;
mu.Enabled = false;
mu.Create();
ModelUserRights ur = new ModelUserRights("owner", "Everyone");
ur.Create();
}
Securable s = new Securable(typeof(ApplicationExceptionSecureService).FullName);
if (!s.Exists)
{
// Default configuration - the safe way.
s.TimeSessionIsIssued = 20;
s.AllowAnonymousAccess = true;
s.Enabled = true;
s.GenerationPasswordLength = 6;
s.AllowedIPFailures = 10;
s.IPsMustBePreregistered = false;
s.IPFailureTimeDenying = 60;
s.DisableIPFiltering = false;
s.SessionsPerIPAllowed = 2;
s.Create();
}
}
开发者ID:phaetto,项目名称:services-update,代码行数:30,代码来源:Services.Packages.Log.Security.ApplicationExceptionSecureService.cs
示例5: UpdateUserImp
internal static void UpdateUserImp(string userName, string oldPassword, string email, string secretQuestion,
string secretAnswer, string SessionToken)
{
if (String.IsNullOrEmpty(userName) ||
String.IsNullOrEmpty(oldPassword) ||
String.IsNullOrEmpty(email) ||
String.IsNullOrEmpty(secretQuestion) ||
String.IsNullOrEmpty(secretAnswer))
{
throw new InvalidOperationException("One of the requested fields is empty.");
}
ModelSession session = CheckSessionImp(SessionToken);
if ( (session.User.Name == userName) ||
CheckUserRightsImp(session.User.Name, "ManageUsers"))
{
ModelUser mu = new ModelUser(userName);
string oldPasswordHash = Platform.Runtime.Security.Hash.ComputeHash(oldPassword, "SHA512", null);
if (mu.PasswordHash != oldPasswordHash)
throw new InvalidOperationException("Old password is invalid.");
if (!mu.Exists)
throw new InvalidOperationException("User does not exist.");
mu.Email = email;
mu.SecretQuestion = secretQuestion;
mu.SecretAnswer = secretAnswer;
mu.Update();
return;
}
throw new UnauthorizedAccessException("Access Denied");
}
开发者ID:phaetto,项目名称:services-update,代码行数:37,代码来源:Services.Packages.Log.Security.ApplicationExceptionSecureService.cs
示例6: CreateSessionImp
internal static void CreateSessionImp(ref ModelSession ms, string userName, string password)
{
if (userName.ToLowerInvariant() == "everyone")
throw new InvalidOperationException("Wrong API call for anonymous access.");
Securable s = new Securable(typeof(ApplicationExceptionSecureService).FullName);
ModelUser mu = new ModelUser(userName);
if (!mu.Exists)
{
if (System.Web.HttpContext.Current != null)
{
IPRegistered ipr = new IPRegistered(System.Web.HttpContext.Current.Request.UserHostAddress);
RegisterIPFailureImp(s, ipr);
}
throw new UnauthorizedAccessException("Access Denied");
}
if (!Platform.Runtime.Security.Hash.VerifyHash(password, "SHA512", mu.PasswordHash))
{
if (System.Web.HttpContext.Current != null)
{
IPRegistered ipr = new IPRegistered(System.Web.HttpContext.Current.Request.UserHostAddress);
RegisterIPFailureImp(s, ipr);
}
throw new UnauthorizedAccessException("Access Denied");
}
if (!mu.Enabled && !ApplicationExceptionSecureService.CheckUserRightsImp(userName, "CannotBeDisabled"))
{
if (System.Web.HttpContext.Current != null)
{
IPRegistered ipr = new IPRegistered(System.Web.HttpContext.Current.Request.UserHostAddress);
RegisterIPFailureImp(s, ipr);
}
throw new UnauthorizedAccessException("Access Denied"); // LoginDisabledException
}
ms.User = mu;
ms.TimeIssued = DateTime.Now;
ms.TimeIssuedFor = s.TimeSessionIsIssued;
ms.Create();
}
开发者ID:phaetto,项目名称:services-update,代码行数:46,代码来源:Services.Packages.Log.Security.ApplicationExceptionSecureService.cs
示例7: GetUserImp
internal static ModelUser GetUserImp(string userName, string SessionToken)
{
if (String.IsNullOrEmpty(userName))
{
throw new InvalidOperationException("One of the requested fields is empty.");
}
ModelSession session = CheckSessionImp(SessionToken);
if (userName.ToLowerInvariant() == "everyone")
throw new UnauthorizedAccessException("Access Denied");
if (CheckUserRightsImp(session.User.Name, "ManageUsers"))
{
ModelUser mu = new ModelUser(userName);
if (!mu.Exists)
throw new InvalidOperationException("User does not exist.");
return mu;
}
throw new UnauthorizedAccessException("Access Denied");
}
开发者ID:phaetto,项目名称:services-update,代码行数:24,代码来源:Services.Packages.Log.Security.ApplicationExceptionSecureService.cs
示例8: Exists
public bool Exists(ModelUser _ModelUser, string SessionToken)
{
if (!ModelUserSecureService.CheckAccessImp(_ModelUser, SessionToken, "Traverse"))
throw new UnauthorizedAccessException("Access Denied");
return _ModelUser.Exists;
}
开发者ID:phaetto,项目名称:services-update,代码行数:7,代码来源:Services.Packages.Security.Security.ModelUserSecureService.cs
示例9: GetApplicationExceptionOwning
public Services.Packages.Log.ApplicationExceptionCollection GetApplicationExceptionOwning(ModelUser _ModelUser, string SessionToken)
{
_ModelUser.Reload();
//*
if (!Services.Packages.Security.Security.ModelUserSecureService.CheckAccessImp(_ModelUser, SessionToken, "Traverse"))
throw new UnauthorizedAccessException("Access Denied");
//*/
/*
if (!Services.Packages.Log.Security.ApplicationExceptionSecureService.CheckAccessImp(_ModelUser.ApplicationExceptionOwning, SessionToken, "Read"))
throw new UnauthorizedAccessException("Access Denied");
//*/
return _ModelUser.ApplicationExceptionOwning;
}
开发者ID:phaetto,项目名称:services-update,代码行数:16,代码来源:Services.Packages.Security.Security.ModelUserSecureService.cs
示例10: Delete
public void Delete(System.String __Name, string SessionToken)
{
ModelUser _ModelUser = new ModelUser(__Name);
if (!ModelUserSecureService.CheckAccessImp(_ModelUser, SessionToken, "Delete"))
throw new UnauthorizedAccessException("Access Denied");
ModelUser.DeleteModelUser(__Name);
}
开发者ID:phaetto,项目名称:services-update,代码行数:9,代码来源:Services.Packages.Security.Security.ModelUserSecureService.cs
示例11: 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
示例12: CreateObjectFromOwner
public void CreateObjectFromOwner(ModelUser _ModelUser, Services.Packages.Security.ModelUser _Owner, string SessionToken)
{
ModelSession session = ModelUserSecureService.CheckSessionImp(SessionToken);
//if (!Services.Packages.Security.Security.ModelUserSecureService.CheckAccessImp(_Owner, SessionToken, "Create ModelUserOwning"))
// throw new UnauthorizedAccessException("Access Denied");
_ModelUser.Reload();
if (!_ModelUser.Exists && !Services.Packages.Security.Security.ModelUserSecureService.CheckAccessImp(_Owner, SessionToken, "Create ModelUserOwning"))
throw new UnauthorizedAccessException("Access Denied");
else if (_ModelUser.Exists && !ModelUserSecureService.CheckAccessImp(_ModelUser, SessionToken, "Update"))
throw new UnauthorizedAccessException("Access Denied");
_ModelUser.Owner = session.User;
_ModelUser.Owner = _Owner;
_ModelUser.Create();
}
开发者ID:phaetto,项目名称:services-update,代码行数:18,代码来源:Services.Packages.Security.Security.ModelUserSecureService.cs
示例13: CreateObject
public void CreateObject(ModelUser _ModelUser, string SessionToken)
{
ModelSession session = ModelUserSecureService.CheckSessionImp(SessionToken);
if (!ModelUserSecureService.CheckUserRightsImp(session.User.Name, "Create " + typeof(ModelUser).FullName))
throw new UnauthorizedAccessException("Access Denied");
_ModelUser.Owner = session.User;
_ModelUser.Create();
}
开发者ID:phaetto,项目名称:services-update,代码行数:10,代码来源:Services.Packages.Security.Security.ModelUserSecureService.cs
示例14: SetACLs
public void SetACLs(ModelUser _ModelUser, Services.Packages.Security.Security.ModelUserAccessControlListCollection _ACLs, string SessionToken)
{
this.Invoke("GetACLs", new object[] {_ModelUser,SessionToken});
return;
}
开发者ID:phaetto,项目名称:services-update,代码行数:5,代码来源:Services.Packages.Security.Security.ModelUserSecureService.cs
示例15: ChangePasswordImp
internal static void ChangePasswordImp(string userName, string oldPassword, string newPassword, string SessionToken)
{
if (String.IsNullOrEmpty(userName) ||
String.IsNullOrEmpty(oldPassword) ||
String.IsNullOrEmpty(newPassword))
{
throw new InvalidOperationException("One of the requested fields is empty.");
}
if (userName.ToLowerInvariant() == "everyone")
throw new InvalidOperationException("Anonymous user cannot have a password.");
ModelSession session = CheckSessionImp(SessionToken);
if ( (session.User.Name == userName) ||
CheckUserRightsImp(session.User.Name, "ManageUsers"))
{
ModelUser mu = new ModelUser(userName);
string oldPasswordHash = Platform.Runtime.Security.Hash.ComputeHash(oldPassword, "SHA512", null);
if (mu.PasswordHash != oldPasswordHash)
throw new InvalidOperationException("Old password is invalid.");
if (!mu.Exists)
throw new InvalidOperationException("User does not exist.");
mu.PasswordHash = Platform.Runtime.Security.Hash.ComputeHash(newPassword, "SHA512", null);
mu.Update();
return;
}
throw new UnauthorizedAccessException("Access Denied");
}
开发者ID:phaetto,项目名称:services-update,代码行数:35,代码来源:Services.Packages.Log.Security.ApplicationExceptionSecureService.cs