Exemple #1
0
        /// <summary>
        /// Get the specified request.
        /// </summary>
        /// <param name="request">Request.</param>
        public object Get(UserGetGroupsRequestTep request)
        {
            List <WebGroup> result = new List <WebGroup>();

            var context = TepWebContext.GetWebContext(PagePrivileges.UserView);

            try {
                context.Open();
                context.LogInfo(this, string.Format("/user/{{usrId}}/group PUT usrId='{0}'", request.UsrId));

                UserTep    user = UserTep.FromIdentifier(context, request.UsrId);
                List <int> ids  = user.GetGroups();

                List <Group> groups = new List <Group>();
                foreach (int id in ids)
                {
                    groups.Add(Group.FromId(context, id));
                }

                foreach (Group grp in groups)
                {
                    result.Add(new WebGroup(grp));
                }

                context.Close();
            } catch (Exception e) {
                context.LogError(this, e.Message, e);
                context.Close();
                throw e;
            }
            return(result);
        }