public Yield GetGroup(DreamContext context, DreamMessage request, Result <DreamMessage> response)
        {
            PermissionsBL.CheckUserAllowed(DekiContext.Current.User, Permissions.READ);
            GroupBE      group       = GetGroupFromUrl();
            DreamMessage responseMsg = DreamMessage.Ok(GroupBL.GetGroupXmlVerbose(group, null));

            response.Return(responseMsg);
            yield break;
        }
        public Yield PostGroupUsers(DreamContext context, DreamMessage request, Result <DreamMessage> response)
        {
            PermissionsBL.CheckUserAllowed(DekiContext.Current.User, Permissions.ADMIN);
            GroupBE group = GetGroupFromUrl();

            group = GroupBL.AddGroupMembers(group, request.ToDocument());
            response.Return(DreamMessage.Ok(GroupBL.GetGroupXmlVerbose(group, null)));
            yield break;
        }
        public Yield DeleteGroupUser(DreamContext context, DreamMessage request, Result <DreamMessage> response)
        {
            PermissionsBL.CheckUserAllowed(DekiContext.Current.User, Permissions.ADMIN);
            GroupBE group = GetGroupFromUrl();
            UserBE  user  = GetUserFromUrlMustExist();

            group = GroupBL.RemoveGroupMember(group, user);
            response.Return(DreamMessage.Ok(GroupBL.GetGroupXmlVerbose(group, null)));
            yield break;
        }
        public Yield PostGroup(DreamContext context, DreamMessage request, Result <DreamMessage> response)
        {
            PermissionsBL.CheckUserAllowed(DekiContext.Current.User, Permissions.ADMIN);
            DreamMessage responseMsg = null;
            GroupBE      group       = GroupBL.PostGroupFromXml(request.ToDocument(), null, context.GetParam("authusername", null), context.GetParam("authpassword", null));

            responseMsg = DreamMessage.Ok(GroupBL.GetGroupXmlVerbose(group, null));
            response.Return(responseMsg);
            yield break;
        }
        public Yield GetGroups(DreamContext context, DreamMessage request, Result <DreamMessage> response)
        {
            PermissionsBL.CheckUserAllowed(DekiContext.Current.User, Permissions.READ);
            uint            totalCount, queryCount;
            IList <GroupBE> groups = GroupBL.GetGroupsByQuery(context, out totalCount, out queryCount);

            XDoc result = new XDoc("groups");

            result.Attr("count", groups.Count);
            result.Attr("querycount", queryCount);
            result.Attr("totalcount", totalCount);
            result.Attr("href", DekiContext.Current.ApiUri.At("groups"));

            foreach (GroupBE g in groups)
            {
                result.Add(GroupBL.GetGroupXmlVerbose(g, null));
            }

            response.Return(DreamMessage.Ok(result));
            yield break;
        }