Ejemplo n.º 1
0
        public Task <string> RenderAsync(int model)
        {
            YTagBuilder tag = new YTagBuilder("span");

            FieldSetup(tag, FieldType.Anonymous);

            using (RoleDefinitionDataProvider dataProvider = new RoleDefinitionDataProvider()) {
                RoleDefinition role = dataProvider.GetRoleById(model);
                tag.SetInnerText(role.Name);
                tag.Attributes.Add(Basics.CssTooltipSpan, role.Description);
            }

            return(Task.FromResult(tag.ToString(YTagRenderMode.Normal)));
        }
Ejemplo n.º 2
0
 public Task <string> GetUserPostLoginUrlAsync(List <int> userRoles)
 {
     if (userRoles != null)
     {
         foreach (int roleId in userRoles)
         {
             using (RoleDefinitionDataProvider roleDP = new RoleDefinitionDataProvider()) {
                 RoleDefinition role = roleDP.GetRoleById(roleId);
                 if (role != null)
                 {
                     if (!string.IsNullOrWhiteSpace(role.PostLoginUrl))
                     {
                         return(Task.FromResult(role.PostLoginUrl));
                     }
                 }
             }
         }
     }
     return(Task.FromResult <string>(null));
 }
Ejemplo n.º 3
0
 public Task <RoleDefinition> FindByIdAsync(string roleId, CancellationToken cancellationToken)
 {
     using (RoleDefinitionDataProvider dataProvider = new RoleDefinitionDataProvider(this.CurrentSiteIdentity)) {
         return(Task.FromResult(dataProvider.GetRoleById(roleId)));
     }
 }