/// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="user">Owner user that own this collection.</param>
        internal UserMessageRuleCollection(User user)
        {
            m_pUser  = user;
            m_pRules = new List<UserMessageRule>();

            Bind();
        }
        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="user">Owner user.</param>
        internal UserEmailAddressCollection(User user)
        {
            m_pUser   = user;
            m_pEmails = new List<string>();

            Bind();
        }
Example #3
0
        /// <summary>
		/// Adds new user to virtual server.
		/// </summary>
		/// <param name="userName">User login name.</param>
		/// <param name="fullName">User full name.</param> 
		/// <param name="password">User login password.</param>
		/// <param name="description">User description.</param>
		/// <param name="mailboxSize">Maximum mailbox size in MB.</param>
		/// <param name="enabled">Sepcifies if user is enabled.</param>
		/// <param name="permissions">Specifies user permissions.</param>
        public User Add(string userName,string fullName,string password,string description,int mailboxSize,bool enabled,UserPermissions_enum permissions)
        {
            /* AddUser <virtualServerID> "<userID>" "<userName>" "<fullName>" "<password>" "<description>" <mailboxSize> <enabled> <permissions>
                  Responses:
                    +OK                     
                    -ERR <errorText>
            */

            string id = Guid.NewGuid().ToString();
            
            // Call TCP AddUser
            m_pVirtualServer.Server.TcpClient.TcpStream.WriteLine("AddUser " + 
                m_pVirtualServer.VirtualServerID + " " + 
                TextUtils.QuoteString(id) + " " + 
                TextUtils.QuoteString(userName) + " " + 
                TextUtils.QuoteString(fullName) + " " + 
                TextUtils.QuoteString(password) + " " + 
                TextUtils.QuoteString(description) + " " + 
                mailboxSize + " " +
                enabled + " " +
                (int)permissions
            );
                        
            string response = m_pVirtualServer.Server.ReadLine();
            if(!response.ToUpper().StartsWith("+OK")){
                throw new Exception(response);
            }

            User user = new User(m_pVirtualServer,this,id,enabled,userName,password,fullName,description,mailboxSize,permissions,DateTime.Now);
            m_pUsers.Add(user);
            return user;
        }
        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="user">Owner user.</param>
        internal UserRemoteServerCollection(User user)
        {
            m_pUser    = user;
            m_pServers = new List<UserRemoteServer>();

            Bind();
        }
Example #5
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 /// <param name="owner">Owner UserFolderCollection collection that owns this object.</param>
 /// <param name="user">Owner user.</param>
 /// <param name="parent">Gets parent folder.</param>
 /// <param name="folderPath">Folder path where folder belongs to.</param>
 /// <param name="folderName">Folder name.</param>
 internal UserFolder(UserFolderCollection owner,User user,UserFolder parent,string folderPath,string folderName)
 {
     m_pOwner        = owner;
     m_pUser         = user;
     m_pParent       = parent;
     m_Path          = folderPath;
     m_FolderName    = folderName;
     m_pChildFolders = new UserFolderCollection(false,this,m_pUser);
 }
        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="virtualServer">Virtual server.</param>
        /// <param name="user">User who's recyclebin to show.</param>
        public wfrm_User_Recyclebin(VirtualServer virtualServer,User user)
        {
            m_pVirtualServer = virtualServer;
            m_pUser          = user;

            InitUI();

            LoadData();
        }
Example #7
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="bind"></param>
        /// <param name="folder">Owner folder or null if root.</param>
        /// <param name="user">Owner user.</param>
        internal UserFolderCollection(bool bind,UserFolder folder,User user)
        {
            m_pFolder  = folder;
            m_pUser    = user;
            m_pFolders = new List<UserFolder>();

            if(bind){
                Bind();
            }
        }
Example #8
0
        /// <summary>
        /// Add constructor.
        /// </summary>
        /// <param name="user">Message rule owner user</param>
        public wfrm_User_MessageRule(User user)
        {
            m_pUser = user;

            InitUI();

            m_pTab.TabPages.Remove(m_pTab_Actions);
            m_pTab_General_MatchExpression.Height -= 25;
            m_pTab_General_Create.Visible = true;
        }
 /// <summary>
 /// Default constructor.
 /// </summary>
 /// <param name="ownerUser">User that owns specified remote server.</param>
 /// <param name="owner">Owner UserRemoteServerCollection collection that owns this remote server.</param>
 /// <param name="id">Remote server ID.</param>
 /// <param name="description">Remote server description.</param>
 /// <param name="host">Remote server name or IP.</param>
 /// <param name="port">Remote server port.</param>
 /// <param name="ssl">Specifies if connected to remote server via SSL.</param>
 /// <param name="userName">Remote server user name.</param>
 /// <param name="password">Remote server password.</param>
 /// <param name="enabled">Specifies if remote server is enabled.</param>
 internal UserRemoteServer(User ownerUser,UserRemoteServerCollection owner,string id,string description,string host,int port,bool ssl,string userName,string password,bool enabled)
 {
     m_pUser       = ownerUser;
     m_pOwner      = owner;
     m_ID          = id;
     m_Description = description;
     m_Host        = host;
     m_Port        = port;
     m_SSL         = ssl;
     m_UserName    = userName;
     m_Password    = password;
     m_Enabled     = enabled;
 }
        //// <summary>
        /// Edit new constructor.
        /// </summary>
        /// <param name="user">Owner user.</param>
        /// <param name="remoteServer">User remote server to update.</param>
        public wfrm_User_RemoteServers_Server(User user,UserRemoteServer remoteServer)
        {
            m_pRemoteServer = remoteServer;

            InitUI();

            m_pDescription.Text = remoteServer.Description;
            m_pServer.Text = remoteServer.Host;
            m_pPort.Value = remoteServer.Port;
            m_pUser.Text = remoteServer.UserName;
            m_pPassword.Text = remoteServer.Password;
            m_UseSSL.Checked = remoteServer.SSL;
            m_pEnabled.Checked = remoteServer.Enabled;
        }
Example #11
0
        /// <summary>
        /// Removes specified user from virtual server.
        /// </summary>
        /// <param name="user">User to remove.</param>
        public void Remove(User user)
        {
            /* DeleteUser <virtualServerID> "<userID>"
                  Responses:
                    +OK                     
                    -ERR <errorText>
            */

            string id = Guid.NewGuid().ToString();

            // Call TCP DeleteUser
            m_pVirtualServer.Server.TcpClient.TcpStream.WriteLine("DeleteUser " + m_pVirtualServer.VirtualServerID + " " + TextUtils.QuoteString(user.UserID));
                        
            string response = m_pVirtualServer.Server.ReadLine();
            if(!response.ToUpper().StartsWith("+OK")){
                throw new Exception(response);
            }

            m_pUsers.Remove(user);
        }
Example #12
0
        /// <summary>
        /// Edit constructor.
        /// </summary>
        /// <param name="user">Message rule owner user</param>
        /// <param name="rule">Rule to update.</param>
        public wfrm_User_MessageRule(User user,UserMessageRule rule)
        {
            m_pUser = user;
            m_pRule = rule;

            InitUI();
        
            m_pTab_General_Enabled.Checked = rule.Enabled;
            if(rule.CheckNextRule == GlobalMessageRule_CheckNextRule_enum.Always){
                m_pTab_General_CheckNextRule.SelectedIndex = 0;
            }
            else if(rule.CheckNextRule == GlobalMessageRule_CheckNextRule_enum.IfMatches){
                m_pTab_General_CheckNextRule.SelectedIndex = 1;
            }
            else if(rule.CheckNextRule == GlobalMessageRule_CheckNextRule_enum.IfNotMatches){
                m_pTab_General_CheckNextRule.SelectedIndex = 2;
            }
            m_pTab_General_Description.Text = rule.Description;
            m_pTab_General_MatchExpression.Text = rule.MatchExpression;
            this.m_pTab_General_MatchExpression_TextChanged(this,new EventArgs());

            LoadActions();
        }
        /// <summary>
        /// Add new constructor.
        /// </summary>
        /// <param name="user">Owner user.</param>
        public wfrm_User_RemoteServers_Server(User user)
        {
            m_pOwnerUser  = user;

            InitUI();
        }
Example #14
0
        private void m_pOk_Click(object sender, EventArgs e)
        {
            #region Validation

            if (m_pGeneral_LoginName.Text.Length == 0){
                MessageBox.Show("Login Name can't be empty!!!","Error",MessageBoxButtons.OK,MessageBoxIcon.Error);				
				return;
            }

            #endregion

            //--- Construct user permissions ----------------------------//
            UserPermissions_enum permissions = UserPermissions_enum.None;
            if(m_pPermissions_AllowPop3.Checked){
                permissions |= UserPermissions_enum.POP3;
            }
            if(m_pPermissions_AllowImap.Checked){
                permissions |= UserPermissions_enum.IMAP;
            }
            if(m_pPermissions_AllowRelay.Checked){
                permissions |= UserPermissions_enum.Relay;
            }
            if(m_pPermissions_AllowSIP.Checked){
                permissions |= UserPermissions_enum.SIP;
            }
            //----------------------------------------------------------//

            // New user, add it
            if(m_pUser == null){
                m_pUser = m_pVirtualServer.Users.Add(
                   m_pGeneral_LoginName.Text,
                   m_pGeneral_FullName.Text,
                   m_pGeneral_Password.Text,
                   m_pGeneral_Description.Text,
                   (int)m_pGeneral_MaxMailboxSize.Value,
                   m_pGeneral_Enabled.Checked,
                   permissions
                );
            }
            // Update user
            else{
                m_pUser.UserName = m_pGeneral_LoginName.Text;
                m_pUser.Password = m_pGeneral_Password.Text;
                m_pUser.FullName = m_pGeneral_FullName.Text;
                m_pUser.Description = m_pGeneral_Description.Text;
                m_pUser.MaximumMailboxSize = (int)m_pGeneral_MaxMailboxSize.Value;
                m_pUser.Enabled = m_pGeneral_Enabled.Checked;
                m_pUser.Permissions = permissions;
                m_pUser.Commit();
            }

           this.DialogResult = DialogResult.OK;
           this.Close();
        }
Example #15
0
        /// <summary>
        /// Edit existing user settings constructor.
        /// </summary>
        /// <param name="virtualServer">Virtual server.</param>
        /// <param name="user">User to update.</param>
        public wfrm_UsersAndGroups_User(VirtualServer virtualServer,User user)
        {
            m_pVirtualServer = virtualServer;
            m_pUser          = user;

            InitUI();
       
            LoadDomains();
            LoadSettings();
            LoadRules("");
            LoadRemoteServers("");
            LoadFolders("");
        }
Example #16
0
        private void m_pTab_General_Create_Click(object sender, EventArgs e)
        {
            #region Validation

            if(m_pGeneral_LoginName.Text.Length == 0){
                MessageBox.Show("Login Name can't be empty !","Error",MessageBoxButtons.OK,MessageBoxIcon.Error);				
				return;
            }

			#endregion
            
            //--- Construct user permissions ----------------------------//
            UserPermissions_enum permissions = UserPermissions_enum.None;
            if(m_pPermissions_AllowPop3.Checked){
                permissions |= UserPermissions_enum.POP3;
            }
            if(m_pPermissions_AllowImap.Checked){
                permissions |= UserPermissions_enum.IMAP;
            }
            if(m_pPermissions_AllowRelay.Checked){
                permissions |= UserPermissions_enum.Relay;
            }
            //----------------------------------------------------------//

            // Add user
            m_pUser = m_pVirtualServer.Users.Add(
                m_pGeneral_LoginName.Text,
                m_pGeneral_FullName.Text,
                m_pGeneral_Password.Text,
                m_pGeneral_Description.Text,
                (int)m_pGeneral_MaxMailboxSize.Value,
                m_pGeneral_Enabled.Checked,
                permissions
            );
                
            m_pTab.TabPages.Add(m_pTabPage_Addressing);
            m_pTab.TabPages.Add(m_pTabPage_Rules);
            m_pTab.TabPages.Add(m_pTabPage_RemoteServers);
            m_pTab.TabPages.Add(m_pTabPage_Permissions);
            m_pTab.TabPages.Add(m_pTabPage_Folders);
            m_pTab_General_Create.Visible = false;

            LoadFolders("");            
        }
        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="folder">User.</param>
        public wfrm_utils_MessagesTransferer(User user)
        {
            m_pUser = user;

            InitUI();

            SwitchStep("source");
        }