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 GetExpiry(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.Expiry(null, permissible) })); } return(Ok(new { Data = DateTime.MaxValue })); }