public IActionResult Group(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) { return(BadRequest(new { Data = "Group not found" })); } AccessType ac = group.Permission(null, user); if (ac != AccessType.Denied) { return(Ok(new { ID = group.ID, Name = group.Name, ParentID = group.Parent == null ? null : group.Parent.ID, Description = group.Description })); } return(BadRequest(new { Data = "Group access denied" })); }
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 UserData(string id, string groupid, bool aggregated) { string userId = this.User.QID(); if (userId == null) { return(null); } QuantApp.Kernel.User user = QuantApp.Kernel.User.FindUser(userId); QuantApp.Kernel.User quser = QuantApp.Kernel.User.FindUser(id); QuantApp.Kernel.Group role = QuantApp.Kernel.Group.FindGroup(groupid); if (role == null) { return(null); } List <Group> sgroups = role.SubGroups(aggregated); List <object> jres = new List <object>(); var lastLogin = UserRepository.LastUserLogin(id); foreach (QuantApp.Kernel.Group group in sgroups) { if (!group.Name.StartsWith("Personal: ")) { AccessType accessType = group.Permission(null, quser); jres.Add( new { ID = group.ID, Name = group.Name, Permission = accessType.ToString() } ); } } return(Ok(new { ID = quser.ID, Email = quser.Email, Permission = role.Permission(null, quser).ToString(), MetaData = quser.MetaData, FirstName = quser.FirstName, LastName = quser.LastName, LastLogin = lastLogin, Groups = jres })); }
public ActionResult GetPermission(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); } if (permissible == null) { return(BadRequest(new { Data = "Permissible ID not found" })); } QuantApp.Kernel.Group group = QuantApp.Kernel.Group.FindGroup(groupid); if (group == null) { group = QuantApp.Kernel.Group.FindGroup(groupid.Replace("_Workflow", "")); } if (group == null) { return(BadRequest(new { Data = "Group ID not found" })); } if (permissible != null) { return(Ok(new { Data = group.Permission(null, permissible) })); } return(Ok(new { Data = AccessType.Denied })); }
public ActionResult GetPermission(string groupid) { string userId = this.User.QID(); if (userId == null) { return(null); } QuantApp.Kernel.IPermissible permissible = 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 (permissible != null && group != null) { return(Ok(new { Data = group.Permission(null, permissible) })); } return(Ok(new { Data = AccessType.Denied })); }
public IActionResult GroupDataApp(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); string profile = group.GetProperty("Profile"); string url = group.Master.GetProperty("URL"); List <object> jres_apps = new List <object>(); object jres = null; AccessType ac = group.Permission(null, user); if (ac != AccessType.Denied) { jres = new { ID = group.ID, Name = group.Name, Master = group == group.Master, Description = group.Description, Profile = profile, URL = url } } ; return(Ok(jres)); }
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)); }