Example #1
0
        public async Task <DeleteUserResults> DeleteUserAsync(int departmentId, string authorizingUserId, string userIdToDelete)
        {
            if (!await _authorizationService.CanUserDeleteUserAsync(departmentId, authorizingUserId, userIdToDelete))
            {
                return(DeleteUserResults.UnAuthroized);
            }

            var department = await _departmentsService.GetDepartmentByUserIdAsync(userIdToDelete);

            if (department.ManagingUserId == userIdToDelete)
            {
                return(DeleteUserResults.UserIsManagingDepartmentAdmin);
            }

            var member = await _departmentsService.GetDepartmentMemberAsync(userIdToDelete, departmentId);

            member.IsDeleted = true;
            await _departmentsService.SaveDepartmentMemberAsync(member);

            //_certificationService.DeleteAllCertificationsForUser(userIdToDelete);
            //_distributionListsService.RemoveUserFromAllLists(userIdToDelete);
            //_personnelRolesService.RemoveUserFromAllRoles(userIdToDelete);
            //_userStateService.DeleteStatesForUser(userIdToDelete);
            //_workLogsService.ClearInvestigationByLogsForUser(userIdToDelete);
            //_workLogsService.DeleteLogsForUser(userIdToDelete, department.ManagingUserId);
            //_messageService.DeleteMessagesForUser(userIdToDelete);
            ////_userProfileService.DeletProfileForUser(userIdToDelete);
            //_pushUriService.DeletePushUrisForUser(userIdToDelete);
            //_actionLogsService.DeleteActionLogsForUser(userIdToDelete);
            //_callsService.DeleteDispatchesForUserAndRemapCalls(department.ManagingUserId, userIdToDelete);
            //_departmentGroupsService.DeleteUserFromGroups(userIdToDelete);
            //_usersService.DeleteUser(userIdToDelete);

            return(DeleteUserResults.NoFailure);
        }