当前位置: 首页>>代码示例>>C#>>正文


C# Roles类代码示例

本文整理汇总了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;
 }
开发者ID:AlexSolari,项目名称:FICTFeed,代码行数:7,代码来源:UserEditViewModel.cs

示例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;
        }
开发者ID:qginformatique,项目名称:GMATechProject,代码行数:33,代码来源:Application.Security.cs

示例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;
        }
开发者ID:ArturKorop,项目名称:PuertoRico,代码行数:7,代码来源:MainBoardController.cs

示例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;
		}
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:11,代码来源:User.cs

示例5: User

 public User(string username, string password, Roles role)
 {
     Username = username;
     PasswordHash = password;
     Role = role;
     Bookings = new List<Booking>();
 }
开发者ID:PlamenaMiteva,项目名称:Quality-Programming-Code,代码行数:7,代码来源:User.cs

示例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);
 }
开发者ID:PushkinTyt,项目名称:Chat,代码行数:7,代码来源:MetaData.cs

示例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;
        }
开发者ID:qginformatique,项目名称:GMATechProject,代码行数:30,代码来源:Application.Blog.cs

示例8: User

 public User(string username, string password, Roles role)
 {
     this.Username = username;
     this.PasswordHash = password;
     this.Role = role;
     this.Bookings = new List<Booking>();
 }
开发者ID:borko9696,项目名称:SoftwareUniversity,代码行数:7,代码来源:User.cs

示例9: TGrupo

 public TGrupo(string nombre, bool habilitado, Roles role)
 {
     this.Nombre = nombre;
     this.Habilitado = habilitado;
     this.Role = role;
     this.Descripcion = string.Empty;
 }
开发者ID:noedelarosa,项目名称:SIC,代码行数:7,代码来源:TGrupo.cs

示例10: AlsoAllowAttribute

        public AlsoAllowAttribute(Roles roles)
        {
            if (roles == Roles.None)
                throw new ArgumentOutOfRangeException(nameof(roles));

            Roles = roles;
        }
开发者ID:shenqiboy,项目名称:Opserver,代码行数:7,代码来源:OnlyAllowAttribute.cs

示例11: AddRole

        public void AddRole(Roles role)
        {
            if (RoleExists(role))
                throw new ArgumentException(TooManyRole);

            entities.Roles.AddObject(role);
        }
开发者ID:XstreamBY,项目名称:BritishMarket,代码行数:7,代码来源:UserRepository.cs

示例12: OnlyAllowAttribute

        public OnlyAllowAttribute(Roles roles)
        {
            if (roles == Roles.None)
                throw new ArgumentOutOfRangeException("roles");

            Roles = roles;
        }
开发者ID:JonBons,项目名称:Opserver,代码行数:7,代码来源:OnlyAllowAttribute.cs

示例13: Player

 public Player(string name, int number, Teams team, Roles role)
 {
     _name = name.Replace(" ", "");
     Number = number;
     Team = team;
     Role = role;
 }
开发者ID:adamrezich,项目名称:arena,代码行数:7,代码来源:Player.cs

示例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();
 }
开发者ID:raazalok,项目名称:IntranetHome,代码行数:7,代码来源:Utility.cs

示例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;
        }
开发者ID:etopcu,项目名称:Dashboard,代码行数:31,代码来源:SecurityDataRepository.cs


注:本文中的Roles类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。