示例#1
0
        public ActionResult <GroupModel> DeleteGroupByIf(DeleteGroupModel groupModel)
        {
            interfaceOperation = true;
            var creator = usersApi.FindIdUserByName(groupModel.Creator);
            var group   = groupsApi.FindGroupByName(groupModel.GroupName);

            if (creator == -1)
            {
                return(RedirectToAction(nameof(MessagePage), new { message = "No such user!" }));
            }
            var permission = permissionsApi.GetPermissionForUserByGroup(creator, group.Id);

            if (permission == null)
            {
                return(RedirectToAction(nameof(MessagePage), new { message = "No information about permission for this group!" }));
            }
            if (permission.Operation != Operation.Admin)
            {
                return(RedirectToAction(nameof(MessagePage), new { message = "No admin permission!" }));
            }
            var result = groupsApi.DeleteGroup(groupModel.GroupName);

            return(RedirectToAction(nameof(GetAllGroupsByIf)));
        }
示例#2
0
        public ActionResult <HttpStatusCode> DeleteUser(string name)
        {
            var result = groupsApi.DeleteGroup(name);

            return(result.StatusCode);
        }