// added in version 3:
 public Boolean addModerator(string modUserName, int forumId, int subForumId, string adderUsrName, string adderPswd, ForumGenerator_Version2_Server.Users.Moderator.modLevel level)
 {
     try
     {
         Boolean res = _forumGen.addModerator(modUserName, forumId, subForumId, adderUsrName, adderPswd, level);
         return res;
     }
     catch (Exception e)
     {
         throw new FaultException(e.Message);
     }
 }
 public bool changeModLevel(int forumId, int subForumId, string moderatorName, ForumGenerator_Version2_Server.Users.Moderator.modLevel newLevel)
 {
     try
     {
         bool res = _forumGen.changeModLevel(forumId, subForumId, moderatorName, newLevel);
         return res;
     }
     catch (Exception e)
     {
         throw new FaultException(e.Message);
     }
 }
Esempio n. 3
0
        public Boolean addModerator(string modUserName, ForumGeneratorContext db, ForumGenerator_Version2_Server.Users.Moderator.modLevel level)
        {
            // check if user is registered to the forum
            Moderator newModerator = new Moderator(parentForum.getUser(modUserName), level);
            if (moderatorExists(modUserName))
                throw new UnauthorizedOperationException(ForumGeneratorDefs.EXIST_MODERATOR);
            if (!newModerator.user.isConfirmed)
                throw new UnauthorizedOperationException(ForumGeneratorDefs.INACTIVE_USR);

            else
            {
                // OK, moderator is not exist
                this.moderators.Add(newModerator);
                db.Moderators.Add(newModerator);
                db.SaveChanges();
                return true;
            }
        }
 public Forum createNewForum(string userName, string password, string forumName, string adminUserName,
                             string adminPassword, ForumGenerator_Version2_Server.ForumData.Forum.RegPolicy registrationPolicy)
 {
     return this.forumGen.createNewForum( userName,  password,  forumName,  adminUserName,
                              adminPassword,  registrationPolicy);
 }
        public Forum createNewForum(string userName, string password, string forumName, string adminUserName, string adminPassword, ForumGenerator_Version2_Server.ForumData.Forum.RegPolicy registrationPolicy)
        {
            try
            {
                Forum res = _forumGen.createNewForum(userName, password, forumName, adminUserName, adminPassword, registrationPolicy);
                return res;
            }
            catch (Exception e)
            {

                throw new FaultException(e.Message);
            }
        }
 public bool addModerator(string modUserName, int forumId, int subForumId, string adderUsrName, string adderPswd, ForumGenerator_Version2_Server.Users.Moderator.modLevel level)
 {
     return this.forumGen.addModerator(modUserName, forumId, subForumId, adderUsrName, adderPswd, level);
 }
 public Forum createNewForum(string userName, string password, string forumName, string adminUserName,
                     string adminPassword, ForumGenerator_Version2_Server.ForumData.Forum.RegPolicy registrationPolicy)
 {
     throw new NotImplementedException();
 }
 public bool addModerator(string modUserName, int forumId, int subForumId, string adderUsrName, string adderPswd, ForumGenerator_Version2_Server.Users.Moderator.modLevel level)
 {
     throw new NotImplementedException();
 }
 public bool addModerator(string modUserName, int forumId, int subForumId, string adderUsrName, string adderPswd, ForumGenerator_Version2_Server.Users.Moderator.modLevel level)
 {
     try
     {
         this.logger.logAction("performing addModerator: modUserName: "******"\tforumId: " + forumId +
                                                  "\tsubForumId: " + subForumId +
                                                  "\tadderUserName: "******"\tadderPswd: " + adderPswd);
         lock (db)
         {
             Forum f = this.getForum(forumId);
             SubForum sf = f.getSubForum(subForumId);
             if (!Security.checkSuperUserAuthorization(this, adderUsrName, adderPswd) &&
                 !Security.checkAdminAuthorization(f, adderUsrName, adderPswd))
             {
                 throw new UnauthorizedUserException(ForumGeneratorDefs.UNAUTH_USER);
             }
             sf.addModerator(modUserName, db, level);
             return true;
         }
     }
     catch (Exception e)
     {
         this.logger.logError("addModerator: " + e.Message);
         throw e;
     }
 }
        //creates a new forum and a new user which is the forum's administrator
        public Forum createNewForum(string userName, string password, string forumName, string adminUserName, 
                                    string adminPassword, ForumGenerator_Version2_Server.ForumData.Forum.RegPolicy registrationPolicy)
        {
            try
            {
                this.logger.logAction("performing createNewForum:  userName: "******"\tpassword: <not detailed>" +
                                                              "\tforumName: " + forumName +
                                                              "\tadminUserName: "******"\tadminPassword: "******"createNewForum: " + e.Message);
                throw e;
            }
        }