public virtual JsonResult ChangeRole(string operationNumber, ActionEnum rol) { _cacheStorageService.Remove("AuthorizationInfo"); var auth = new AuthorizationOperationInfo() { ActionList = new List <ActionEnum>(), RoleList = new List <RoleEnum>() { RoleEnum.Unrecognized }, UserName = IDBContext.Current.UserLoginName }; auth.ActionList.Add(ActionEnum.ConvergenceReadPermission); auth.ActionList.Add(rol); var authPermission = new AuthorizationInfo() { Authorization = new Dictionary <string, AuthorizationOperationInfo>() }; authPermission.Authorization.Add(operationNumber, auth); _cacheStorageService.Add("AuthorizationInfo", authPermission); return(Json(new { IsValid = true, ErrorMessage = "Permissions was changed" })); }
public virtual JsonResult ChangeRol(string operationNumber, ActionEnum permission) { _cacheStorageService.Remove("AuthorizationInfo"); var auth = new AuthorizationOperationInfo() { ActionList = new List <ActionEnum>(), RoleList = new List <RoleEnum>() { RoleEnum.PCRProjectTeamLeader }, UserName = IDBContext.Current.UserName }; auth.ActionList.Add(ActionEnum.ConvergenceReadPermission); if (!auth.ActionList.Any(x => x == permission)) { auth.ActionList.Add(permission); } var authPermission = new AuthorizationInfo() { Authorization = new Dictionary <string, AuthorizationOperationInfo>() }; authPermission.Authorization.Add(operationNumber, auth); _cacheStorageService.Add("AuthorizationInfo", authPermission); return(Json(new { IsValid = true, ErrorMessage = "Permissions was changed" })); }
public virtual JsonResult ChangeRoleAndPermissions(string operationNumber, RoleEnum role) { _cacheStorageService.Remove("AuthorizationInfo"); var auth = new AuthorizationOperationInfo { ActionList = new List <ActionEnum>(), RoleList = new List <RoleEnum> { RoleEnum.PCRProjectTeamLeader, role }, UserName = IDBContext.Current.UserLoginName }; foreach (var permission in RolePermissions[role]) { auth.ActionList.Add(permission); } var authPermission = new AuthorizationInfo { Authorization = new Dictionary <string, AuthorizationOperationInfo>() }; authPermission.Authorization.Add(operationNumber, auth); _cacheStorageService.Add("AuthorizationInfo", authPermission); return(Json(new { IsValid = true, ErrorMessage = "Permissions was changed" })); }
public virtual JsonResult ChangeGlobalActionOrRoles(string workspace, RoleEnum?role, ActionEnum[] actionEnum) { _cacheStorageService.Remove("AuthorizationInfo"); var auth = new AuthorizationOperationInfo() { ActionList = new List <ActionEnum>(), RoleList = new List <RoleEnum>(), UserName = IDBContext.Current.UserLoginName }; if (role.HasValue) { auth.RoleList.Add(role.Value); } for (var i = 0; i < actionEnum.Count(); i++) { if (!auth.ActionList.Any(x => x == actionEnum[i])) { auth.ActionList.Add(actionEnum[i]); } } var authPermission = new AuthorizationInfo(); authPermission.GlobalAuthorization = auth; _cacheStorageService.Add("AuthorizationInfo", authPermission); return(Json(new { IsValid = true, ErrorMessage = "Permissions was changed" })); }
public virtual ActionResult SetMockGlobalPermission(ActionEnum[] actions = null) { _cacheStorageService.Remove("AuthorizationInfo"); var auth = new AuthorizationOperationInfo { ActionList = new List <ActionEnum>(), RoleList = new List <RoleEnum>(), UserName = IDBContext.Current.UserLoginName }; if ((actions != null) && actions.Length > 0) { auth.ActionList.AddRange(actions); } var authPermission = new AuthorizationInfo { GlobalAuthorization = auth }; _cacheStorageService.Add("AuthorizationInfo", authPermission); return(Json(new { IsValid = true, ErrorMessage = "Permissions was changed" })); }
public virtual JsonResult ChangeWorspaceActionOrRole(string workspace, RoleEnum?role, ActionEnum?action) { _cacheStorageService.Remove("AuthorizationInfo"); var auth = new AuthorizationOperationInfo() { ActionList = new List <ActionEnum>(), RoleList = new List <RoleEnum>(), UserName = IDBContext.Current.UserLoginName }; if (role.HasValue) { auth.RoleList.Add(role.Value); } auth.ActionList.Add(ActionEnum.ConvergenceReadPermission); if (!auth.ActionList.Any(x => x == action)) { if (action.HasValue) { auth.ActionList.Add(action.Value); } } var authPermission = new AuthorizationInfo() { Authorization = new Dictionary <string, AuthorizationOperationInfo>() }; authPermission.WorkspaceAuthorization.Add(workspace, auth); _cacheStorageService.Add("AuthorizationInfo", authPermission); return(Json(new { IsValid = true, ErrorMessage = "Permissions was changed" })); }