本文整理汇总了C#中Roles类的典型用法代码示例。如果您正苦于以下问题:C# Roles类的具体用法?C# Roles怎么用?C# Roles使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Roles类属于命名空间,在下文中一共展示了Roles类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UserEditViewModel
public UserEditViewModel(string name, string mail, Roles role = Roles.User)
{
Name = name;
Mail = mail;
Role = role;
GroupId = Resolver.GetInstance<IGroupsManager>().GetByName("Global").Id;
}
示例2: CreateIdentity
public Identity CreateIdentity(string email, string password, Roles role = Roles.User)
{
Identity result = null;
var identity = new Identity ()
{
ExternalIdentifier = Guid.NewGuid().ToString(),
Email = email,
Password = this._PasswordUtility.HashPassword(password ?? this._PasswordUtility.Generate ()),
Role = role
};
result = this._IdentityRepository.Add (identity);
this._Logger.Debug("Identity created : {0}", result != null);
if (result != null) {
try
{
var configuration = ConfigurationHelper.Get<ApplicationConfiguration> ();
if (configuration != null) {
this.SendIdentityEmail (identity, "AccountActivation");
}
}
catch(Exception exception)
{
this._Logger.ErrorException("Erreur lors de l'envoi du mail d'activation à " + email + " : " + exception.ToString(), exception);
}
}
return result;
}
示例3: TryGetRoleCard
public bool TryGetRoleCard(Roles currentRole, out RoleCard roleCard)
{
// TODO: add find with max money
roleCard = _status.RoleCards.FirstOrDefault(x => x.Role == currentRole && !x.IsUsed);
return roleCard != null;
}
示例4: User
/// <summary>
/// Construct instance from existing data. This is the constructor invoked by
/// Gentle when creating new User instances from result sets.
/// </summary>
public User( int userId, string firstName, string lastName, Roles primaryRole )
{
id = userId;
this.firstName = firstName;
this.lastName = lastName;
this.primaryRole = primaryRole;
}
示例5: User
public User(string username, string password, Roles role)
{
Username = username;
PasswordHash = password;
Role = role;
Bookings = new List<Booking>();
}
示例6: MetaData
public MetaData(Roles role, Actions action, ContentTypes contentType, string message)
{
this.role = role;
this.action = action;
this.contentType = contentType;
messageSize = encoding.GetByteCount(message);
}
示例7: ListPublishedArticles
public PaginatedList<Article> ListPublishedArticles(int pageIndex = 0, int pageSize = 10, Roles role = Roles.None, string[] tags = null)
{
var tagsForbiddenForRole = this._RoleTagsBindingRepository.ListTagsForbiddenForRole(role);
this._Logger.Debug("ListPublishedArticles: role = " + role);
this._Logger.Debug("ListPublishedArticles: tags forbidden for role = " + string.Join(", ", tagsForbiddenForRole));
var query =
// We want all the enabled events
(from @event in this._ArticleRepository.QueryPublished(tags)
select @event);
// If our user is not an administrator
if(role != Roles.Administrator)
{
query =
(from article in query
// Filter: all events without any tags
where (!article.Tags.Any ())
// Or: @events who have all their tags bound to this role
|| (!article.Tags.ContainsAny(tagsForbiddenForRole))
select article);
}
var result = query
.OrderByDescending (article => article.PublicationDate)
.ToPaginatedList (pageIndex, pageSize);
return result;
}
示例8: User
public User(string username, string password, Roles role)
{
this.Username = username;
this.PasswordHash = password;
this.Role = role;
this.Bookings = new List<Booking>();
}
示例9: TGrupo
public TGrupo(string nombre, bool habilitado, Roles role)
{
this.Nombre = nombre;
this.Habilitado = habilitado;
this.Role = role;
this.Descripcion = string.Empty;
}
示例10: AlsoAllowAttribute
public AlsoAllowAttribute(Roles roles)
{
if (roles == Roles.None)
throw new ArgumentOutOfRangeException(nameof(roles));
Roles = roles;
}
示例11: AddRole
public void AddRole(Roles role)
{
if (RoleExists(role))
throw new ArgumentException(TooManyRole);
entities.Roles.AddObject(role);
}
示例12: OnlyAllowAttribute
public OnlyAllowAttribute(Roles roles)
{
if (roles == Roles.None)
throw new ArgumentOutOfRangeException("roles");
Roles = roles;
}
示例13: Player
public Player(string name, int number, Teams team, Roles role)
{
_name = name.Replace(" ", "");
Number = number;
Team = team;
Role = role;
}
示例14: BindAdminRegionsDropDown
public static void BindAdminRegionsDropDown(String empNo, Roles role, ICacheStorage adapter, DropDownList d)
{
d.DataSource = BllAdmin.GetRegionsByRights(empNo, role, adapter);
d.DataTextField = "Value";
d.DataValueField = "Key";
d.DataBind();
}
示例15: getRoles
public Roles getRoles(User secureuser)
{
var userRoles = new Roles();
string strQuery = "SELECT dbo.udf_GetEmployeeType(@cUser_Cd) AS EmployeeType_Txt ";
var employeeType = (_connection.Query<EmployeeType>(strQuery, new { cUser_Cd = secureuser.Id }).SingleOrDefault());
if(employeeType == null)
throw new Exception("Something Bad Happened");
employeeType.Initialize();
if (employeeType.IsAdmin)
{
userRoles = userRoles | Roles.Admin;
}
else if (employeeType.IsManager)
{
strQuery = "select Access_Cd from Security..UserSettings where User_Cd = @cUser_Cd";
var managerType = (_connection.Query<string>(strQuery, new { cUser_Cd = secureuser.Id }).SingleOrDefault());
if(managerType == null)
throw new Exception("Something Bad Happened");
managerType = managerType.Trim();
if(managerType.Equals("D"))
userRoles = userRoles | Roles.ManagerDepartment;
else
userRoles = userRoles | Roles.ManagerEmployee;
}
else
{
userRoles = userRoles | Roles.Ess;
}
return userRoles;
}