Exemplo n.º 1
0
        public ActionResult RemoveMember(string userid, string groupID)
        {
            string me = whoami();

            MembershipHelper.CheckAdmin(groupID, me);
            _groupManager.RemoveMember(groupID, whoami(), userid);
            return(ActionResult.Success());
        }
Exemplo n.º 2
0
        public ActionResult UpdateMembership(string groupID, string userid, string role)
        {
            string me = whoami();

            MembershipHelper.CheckAdmin(groupID, me);
            _groupManager.UpdateMembership(groupID, whoami(), userid, role);

            return(ActionResult.Success());
        }
Exemplo n.º 3
0
        public ActionResult AddMember(string userid, string groupID)
        {
            string me = whoami();

            MembershipHelper.CheckAdmin(groupID, me);
            Membership member = _groupManager.AddMember(groupID, userid);

            MembershipHelper.RefreshJoinedGroup(userid);
            return(ActionResult.Success());
        }
Exemplo n.º 4
0
        public DisplayCategory CreateCategory(string name, string group = null, string description = null)
        {
            string me = whoami();

            if (string.IsNullOrEmpty(group))
            {
                group = MembershipHelper.DefaultGroup(me);
            }

            MembershipHelper.CheckAdmin(group, me);
            return(_categoryManager.CreateCategory(name, group, me, description));
        }
Exemplo n.º 5
0
        public ActionResult DeleteDataSet(int id)
        {
            MetricDataSet dataset = _metricManager.GetDataSet(id);
            string        me      = whoami();

            if (!me.Equals(dataset.Creater))
            {
                MembershipHelper.CheckAdmin(dataset.GroupID, me);
            }

            _metricManager.DeleteDataSet(id);
            return(new ActionResult());
        }
Exemplo n.º 6
0
        public DisplayGroup UpdateGroup(string groupID, string displayname = null, string description = null, bool isOpen = false)
        {
            string me = whoami();

            MembershipHelper.CheckAdmin(groupID, me);

            Group group = new Group();

            group.GroupID     = groupID;
            group.DisplayName = displayname;
            group.Description = description;
            group.IsOpen      = isOpen;
            return(new DisplayGroup(_groupManager.UpdateGroup(me, group), me, new MSGorillaEntities()));
        }
Exemplo n.º 7
0
        public DisplayUserProfile CreateGroupRobotAccount(string groupID, string userid, string password, string displayname = null, string description = null)
        {
            string me = whoami();

            MembershipHelper.CheckAdmin(groupID, me);

            UserProfile robot = new UserProfile();

            robot.Userid          = userid;
            robot.DisplayName     = displayname;
            robot.Description     = description;
            robot.FollowingsCount = 0;
            robot.FollowersCount  = 0;
            robot.MessageCount    = 0;
            robot.IsRobot         = true;
            robot.Password        = Utils.MD5Encoding(password);
            robot.DefaultGroup    = groupID;

            return(new DisplayUserProfile(_groupManager.CreateGroupRobotAccount(groupID, me, robot), 0));
        }