• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Roles类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Roles的典型用法代码示例。如果您正苦于以下问题:C# Roles类的具体用法?C# Roles怎么用?C# Roles使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Roles类属于命名空间,在下文中一共展示了Roles类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: UserIsInRole

 //public static bool UserIsSuperAdmin(this HttpContext ctx) {
 //    if (!ctx.User.Identity.IsAuthenticated) {
 //        return false;
 //    }
 //    var user = ctx.ActiveUserComplete();
 //    return user != null && user.IsSuperAdmin();
 //}
 // **************************************
 // UserIsInRole
 // **************************************
 public static bool UserIsInRole(this IPrincipal princ, Roles role)
 {
     if (!princ.Identity.IsAuthenticated) {
         return false;
     }
     var user = SessionService.Session().User(princ.Identity.Name);
     return user != null && user.IsInRole(role);
 }
开发者ID:cherther,项目名称:SongSearch,代码行数:18,代码来源:UserExtensions.cs


示例17: GetDescription

        public string GetDescription(Roles roleValue)
        {
            var dictionary = this.RolesToDescriptionManager.EnumToDescription;

            Debug.Assert(dictionary.ContainsKey(roleValue));

            return dictionary[roleValue];
        }
开发者ID:seriussoft,项目名称:migraineDiary_Alpha,代码行数:8,代码来源:RoleModel.cs


示例18: RedirectToWelcomeIfNotInRole

 public static void RedirectToWelcomeIfNotInRole(Roles role)
 {
     var user = Users.Current;
     if (!Users.IsInRole(user, role))
     {
         HttpContext.Current.Response.Redirect(user.HomePage);
     }
 }
开发者ID:robgray,项目名称:Tucana,代码行数:8,代码来源:Security.cs


示例19: createRole

 public static bool createRole(Roles role)
 {
     using (DataClassesEduDataContext dc = new DataClassesEduDataContext())
     {
         dc.Roles.InsertOnSubmit(role);
         dc.SubmitChanges();
         return true;
     }
 }
开发者ID:kexinn,项目名称:Edu,代码行数:9,代码来源:RoleManagement.cs


示例20: InitFilter

        public void InitFilter(ServiceConfigParameters ServiceConfigParameters, RuntimeProperties RuntimeProperties, Roles Role, int SelfUserID)
        {
            RuntimeProperties.SetRuleValue(this.RoleContext.ToString(), RuntimeProperties.UserGroup.PropertyName);

            CountryCodeIncludingFilterParameter countrycodeparam = new CountryCodeIncludingFilterParameter();
            countrycodeparam.Filter = this.GetUserRoleFilter(ServiceConfigParameters, RuntimeProperties, Role);
            countrycodeparam.DefaultSeparator = Constants.DEFAULT_SEPARATOR;
            _CountryCodeIncludingFilter = new CountryCodeIncludingFilter(countrycodeparam);
        }
开发者ID:PSDevGithub,项目名称:PSIntranetService,代码行数:9,代码来源:HRReportAccessibilityRoleValidation.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Room类代码示例发布时间:2022-05-24
下一篇:
C# RoleViewModel类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap