Esempio n. 1
0
        public async Task RemoveFromRoleAsync(User user, string roleName, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            await new Task(
                () =>
            {
                using (Role role = Role.FindByNormalizedName(roleName, connection, null))
                    using (UserRole userRole = UserRole.FindByUserIdAndRoleId(user.Id, role.Id, connection, null))
                    {
                        if (role == null)
                        {
                            throw new UserException($"Não foi encontrado nenhum nível de acesso com o nome '{roleName}'!");
                        }

                        if (userRole == null)
                        {
                            throw new UserException($"Não foi encontrado nenhum nível de acesso com o nome '{roleName}' para o usuário '{user.Nome}'!");
                        }

                        userRole.Delete(connection, null);
                    }
            }
                );
        }
Esempio n. 2
0
        protected void EgvUserRole_RowCommand(object sender, CommandEventArgs e)
        {
            bool   flag        = false;
            int    roleId      = DataConverter.CLng(e.CommandArgument);
            string commandName = e.CommandName;

            if (commandName != null)
            {
                if (!(commandName == "ModifyRole"))
                {
                    if (commandName == "DeleteRole")
                    {
                        flag = UserRole.Delete(roleId);
                    }
                    else if (commandName == "CommonPermissions")
                    {
                        BasePage.ResponseRedirect("RolePermissions.aspx?Action=Modify&RoleId=" + roleId);
                    }
                    else if (commandName == "FieldPermissions")
                    {
                        BasePage.ResponseRedirect("RoleFieldPermissions.aspx?PermissionsType=Role&RoleId=" + roleId);
                    }
                }
                else
                {
                    BasePage.ResponseRedirect("Role.aspx?Action=Modify&RoleId=" + roleId);
                }
            }
            if (flag)
            {
                AdminPage.WriteSuccessMsg("删除角色成功!", "RoleManage.aspx");
            }
        }
Esempio n. 3
0
 /// <summary>
 ///     Modify UserRole object to database
 ///     <param name="o">UserRole to be modified.</param>
 ///     <retvalue>void</retvalue>
 /// </summary>
 public void Delete(UserRole o)
 {
     if (o != null)
     {
         o.Delete(_conn);
         if (o.HasError)
         {
             _hasError = true;
         }
     }
 }
Esempio n. 4
0
 public int UBindUserRole(IEnumerable <UserRole> userRole)
 {
     return(_userRole.Delete(userRole));
 }
Esempio n. 5
0
 public static void DeleteTodoResourceRole(int TodoId, int UserId)
 {
     UserRole.Delete(CreateTodoContainerKey(TodoId), TodoResourceRoleName, UserId);
 }
Esempio n. 6
0
 public static void DeleteEventResourceRole(int EventId, int UserId)
 {
     UserRole.Delete(CreateEventContainerKey(EventId), EventResourceRoleName, UserId);
 }
Esempio n. 7
0
 public static void DeleteDocumentTodoResourceRole(int DocumentId, int UserId)
 {
     UserRole.Delete(CreateDocumentContainerKey(DocumentId), DocumentTodoResource, UserId);
 }
Esempio n. 8
0
 public static void DeleteAdminRole(int UserId)
 {
     UserRole.Delete(AdminRoleName, UserId);
 }
Esempio n. 9
0
 public static void DeleteTaskTodoResourceRole(int TaskId, int UserId)
 {
     UserRole.Delete(CreateTaskContainerKey(TaskId), TaskTodoResource, UserId);
 }
Esempio n. 10
0
 public static void DeleteTaskManagerRole(int TaskId, int UserId)
 {
     UserRole.Delete(CreateTaskContainerKey(TaskId), TaskManagerRoleName, UserId);
 }
Esempio n. 11
0
 public static void DeleteIssueTodoResourceRole(int IssueId, int UserId)
 {
     UserRole.Delete(CreateIssueContainerKey(IssueId), IssueTodoResource, UserId);
 }
Esempio n. 12
0
 public static void DeleteIssueManagerRole(int IssueId, int UserId)
 {
     UserRole.Delete(CreateIssueContainerKey(IssueId), IssueManagerRoleName, UserId);
 }
Esempio n. 13
0
 public static void DeleteProjectStakeHolderRole(int ProjectId, int UserId)
 {
     UserRole.Delete(CreateProjectContainerKey(ProjectId), ProjectStakeHolderRoleName, UserId);
 }
Esempio n. 14
0
 public static void DeleteExecutiveManagerRole(int ProjectId, int UserId)
 {
     UserRole.Delete(CreateProjectContainerKey(ProjectId), ExecutiveManagerRoleName, UserId);
 }
Esempio n. 15
0
 public static void DeleteDocumentManagerRole(int DocumentId, int UserId)
 {
     UserRole.Delete(CreateDocumentContainerKey(DocumentId), DocumentManagerRoleName, UserId);
 }
Esempio n. 16
0
        public void DeleteTest()
        {
            UserRole temp = new UserRole("admin", "Administration");

            Assert.True(temp.Delete());
        }
Esempio n. 17
0
 public static void DeletePowerProjectManagerRole(int UserId)
 {
     UserRole.Delete(PowerProjectManagerRoleName, UserId);
 }