Ejemplo n.º 1
0
        public static Forum create(string name, ForumPolicy policy, List <SubForum> subForums)
        {
            List <string> input = new List <string>()
            {
                name
            };

            foreach (SubForum sf in subForums)
            {
                input.Add(sf.getName());
            }
            if (!Constants.isValidInput(input) || policy == null)
            {
                return(null);
            }
            return(new Forum(name, policy, subForums));
        }
Ejemplo n.º 2
0
        private bool setForumPolicy(ForumPolicy p)
        {
            int i_pdp = 2;
            postDeletionPermission e_pdp = p.getPostDeletionPermissions();

            switch (e_pdp)
            {
            case postDeletionPermission.MODERATOR:
                i_pdp = 3;
                break;

            case postDeletionPermission.ADMIN:
                i_pdp = 4;
                break;

            case postDeletionPermission.SUPER_ADMIN:
                i_pdp = 5;
                break;
            }
            int i_mup = 2;
            modUnassignmentPermission e_mup = p.getModUnassignmentPermissions();

            switch (e_mup)
            {
            case modUnassignmentPermission.ASSIGNING_ADMIN:
                i_mup = 3;
                break;

            case modUnassignmentPermission.SUPER_ADMIN:
                i_mup = 4;
                break;
            }
            if (!ForumSystem._db.changeForumPolicy(p.getMaxAdmins(), p.getMinAdmins(), p.getMaxModerators(), p.getMinModerators(), _name,
                                                   i_pdp, p.getPasswordLifespan(), p.getModeratorsSeniority(), i_mup))
            {
                return(false);
            }
            return(true);
        }
Ejemplo n.º 3
0
 private Forum(string name, ForumPolicy policy, List <SubForum> subForums)
 {
     _name      = name;
     _policy    = policy;
     _subForums = subForums;
 }
Ejemplo n.º 4
0
 private Forum(string name)
 {
     _name      = name;
     _policy    = new ForumPolicy();
     _subForums = new List <SubForum>();
 }