public ActionResult RemovePermission(string pid, string groupid) { string userId = this.User.QID(); if (userId == null) { return(null); } QuantApp.Kernel.IPermissible permissible = QuantApp.Kernel.User.FindUser(pid); if (permissible == null) { permissible = QuantApp.Kernel.User.FindUserBySecret(pid); } if (permissible == null) { permissible = FileRepository.File(pid); } QuantApp.Kernel.Group group = QuantApp.Kernel.Group.FindGroup(groupid); if (group == null) { group = QuantApp.Kernel.Group.FindGroup(groupid.Replace("_Workflow", "")); } if (permissible != null) { group.Remove(permissible); return(Ok(new { Data = "ok" })); } return(BadRequest(new { Data = "Permissible ID not found" })); }
public async Task<IActionResult> Files(string groupid) { string userId = this.User.QID(); if (userId == null) return Unauthorized(); QuantApp.Kernel.User user = QuantApp.Kernel.User.FindUser(userId); QuantApp.Kernel.Group role = QuantApp.Kernel.Group.FindGroup(groupid); if(role == null) return BadRequest(new { Data = "Group not found "}); List<object> jres = new List<object>(); List<IPermissible> files = role.List(user, typeof(FilePermission), false); foreach (FilePermission file_mem in files) { FilePermission file = FileRepository.File(file_mem.ID); if (file != null) jres.Add(new { ID = file.ID, Name = file.Name, Owner = file.Owner.FirstName + " " + file.Owner.LastName, Size = file.Size, Date = (file.Timestamp.ToString("yyyy/MM/dd")), Type = file.Type, Permission = (int)role.Permission(null, file_mem) }); else role.Remove(file_mem); } return Ok(jres); }
public IActionResult Users(string groupid) { string userId = this.User.QID(); if (userId == null) { return(null); } QuantApp.Kernel.User user = QuantApp.Kernel.User.FindUser(userId); QuantApp.Kernel.Group role = QuantApp.Kernel.Group.FindGroup(groupid); if (role == null) { role = QuantApp.Kernel.Group.FindGroup(groupid.Replace("_Workflow", "")); } if (role == null) { role = QuantApp.Kernel.Group.CreateGroup(groupid, groupid); } List <IPermissible> users = role.Master.List(QuantApp.Kernel.User.CurrentUser, typeof(QuantApp.Kernel.User), false); List <object> jres = new List <object>(); foreach (QuantApp.Kernel.User user_mem in users) { QuantApp.Kernel.User quser = QuantApp.Kernel.User.FindUser(user_mem.ID); if (quser != null) { var ac = role.Permission(null, user_mem); var exp = role.Expiry(null, user_mem); if (quser.ID != "System") { jres.Add(new { ID = quser.ID, FirstName = quser.FirstName, LastName = quser.LastName, Email = quser.Email, Permission = ac.ToString(), Expiry = new { year = exp.Year, month = exp.Month, day = exp.Day }, MetaData = quser.MetaData, }); } } else { role.Remove(user_mem); } } return(Ok(jres)); }
public ActionResult RemovePermission(string userid, string groupid) { string userId = this.User.QID(); if (userId == null) { return(null); } QuantApp.Kernel.User user = QuantApp.Kernel.User.FindUser(userid); QuantApp.Kernel.Group group = QuantApp.Kernel.Group.FindGroup(groupid); if (group == null) { group = QuantApp.Kernel.Group.FindGroup(groupid.Replace("_WorkSpace", "")); } group.Remove(user); return(Ok("done")); }
public ActionResult RemovePermission(string userid, string groupid) { string userId = this.User.QID(); if (userId == null) { return(null); } QuantApp.Kernel.User user = QuantApp.Kernel.User.FindUser(userid); QuantApp.Kernel.Group group = QuantApp.Kernel.Group.FindGroup(groupid); if (group == null) { group = QuantApp.Kernel.Group.FindGroup(groupid.Replace("_Workflow", "")); } if (user != null) { group.Remove(user); return(Ok(new { Data = "ok" })); } return(Ok(new { Data = "error" })); }
public IActionResult UsersApp_contacts(string groupid, bool agreements) { string userId = this.User.QID(); if (userId == null) { return(null); } QuantApp.Kernel.User user = QuantApp.Kernel.User.FindUser(userId); if (user == null) { return(null); } QuantApp.Kernel.Group role = QuantApp.Kernel.Group.FindGroup(groupid); if (role == null) { role = QuantApp.Kernel.Group.FindGroup(groupid.Replace("_WorkSpace", "")); } if (role == null) { return(null); } List <IPermissible> users = role.Master.List(user, typeof(QuantApp.Kernel.User), false); Dictionary <string, List <string> > lastLogin = UserRepository.LastUserLogins(role); List <object> jres = new List <object>(); foreach (QuantApp.Kernel.User user_mem in users) { QuantApp.Kernel.User quser = QuantApp.Kernel.User.FindUser(user_mem.ID); if (quser != null) { List <object> jres_tracks = new List <object>(); var ac = role.Permission(null, user_mem); jres.Add(new { ID = quser.ID, first = quser.FirstName, last = quser.LastName, email = quser.Email, group = ac.ToString(), meta = quser.MetaData, LastLoginDate = !lastLogin.ContainsKey(quser.ID) ? "" : lastLogin[quser.ID][0], LastLoginIP = !lastLogin.ContainsKey(quser.ID) ? "" : lastLogin[quser.ID][1], }); } else { role.Remove(user_mem); } } return(Ok(new { items = jres })); }
public IActionResult Users(string groupid) { string userId = this.User.QID(); if (userId == null) { return(null); } QuantApp.Kernel.User user = QuantApp.Kernel.User.FindUser(userId); if (user == null) { return(null); } QuantApp.Kernel.Group role = QuantApp.Kernel.Group.FindGroup(groupid); if (role == null) { role = QuantApp.Kernel.Group.FindGroup(groupid.Replace("_Workflow", "")); } if (role == null) { role = QuantApp.Kernel.Group.CreateGroup(groupid, groupid); // return null; } List <IPermissible> users = role.Master.List(QuantApp.Kernel.User.CurrentUser, typeof(QuantApp.Kernel.User), false); // Dictionary<string, List<string>> lastLogin = UserRepository.LastUserLogins(role); List <object> jres = new List <object>(); foreach (QuantApp.Kernel.User user_mem in users) { QuantApp.Kernel.User quser = QuantApp.Kernel.User.FindUser(user_mem.ID); if (quser != null) { List <object> jres_tracks = new List <object>(); var ac = role.Permission(null, user_mem); jres.Add(new { ID = quser.ID, FirstName = quser.FirstName, LastName = quser.LastName, Email = quser.Email, Permission = ac.ToString(), MetaData = quser.MetaData, // LastLoginDate = !lastLogin.ContainsKey(quser.ID) ? "" : lastLogin[quser.ID][0], // LastLoginIP = !lastLogin.ContainsKey(quser.ID) ? "" : lastLogin[quser.ID][1], }); } else { role.Remove(user_mem); } } return(Ok(jres)); }