コード例 #1
0
        public ActionResult SubGroupsApp(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.Group role = QuantApp.Kernel.Group.FindGroup(groupid);

            List <Group> sgroups = role.SubGroups(aggregated);



            List <object> jres = new List <object>();

            foreach (Group group in sgroups)
            {
                AccessType ac = group.Permission(null, user);
                if (ac != AccessType.Denied)
                {
                    jres.Add(new
                    {
                        ID          = group.ID,
                        Name        = group.Name,
                        Description = group.Description,
                        Permission  = ac.ToString(),
                    });
                }
            }

            return(Ok(jres));
        }
コード例 #2
0
        public ActionResult SubGroups(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.Group role = QuantApp.Kernel.Group.FindGroup(groupid);

            if (role == null)
            {
                return(BadRequest(new { Data = "Group not found" }));
            }

            List <Group>  sgroups = role.SubGroups(aggregated);
            List <object> jres    = new List <object>();

            foreach (Group group in sgroups)
            {
                jres.Add(new
                {
                    ID          = group.ID,
                    Name        = group.Name,
                    Description = group.Description,
                    ParentID    = group.Parent == null ? null : group.Parent.ID
                });
            }

            return(Ok(jres));
        }
コード例 #3
0
        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
            }));
        }