User Tools

Site Tools


reference:user_manager_script

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
reference:user_manager_script [2024/04/22 09:37] paulreference:user_manager_script [2026/05/29 14:47] (current) – [ProcessCopySettings] paul
Line 3: Line 3:
 If you want people to be able to log in using a different username than their VPOP3 username (eg if you want them to be able to log in using an email address), then you can use the UserManager Lua script If you want people to be able to log in using a different username than their VPOP3 username (eg if you want them to be able to log in using an email address), then you can use the UserManager Lua script
  
-The Lua script is managed through the Settings → Scripts page in VPOP3 v8.0 and later and is called 'UserManager.LUA.+The Lua script is managed through the Settings → Scripts page in VPOP3 v8.0 and later and is called 'UserManager.LUA
 + 
 +====TranslateUsername====
  
 VPOP3 calls a function called **TranslateUsername** which should have the following prototype: VPOP3 calls a function called **TranslateUsername** which should have the following prototype:
  
-  TranslateUsername(<protocol>, <submitted username>)+  function TranslateUsername(<protocol>, <submitted username>)
  
 Protocol indicates which protocol is being used to log in, and is one of: Protocol indicates which protocol is being used to log in, and is one of:
Line 29: Line 31:
                 }                 }
  
-    if (users[username]) then +    if (users[Username]) then 
-        return users[username]+        return users[Username]
     end     end
          
-    return username;+    return Username;
 end end
 </code> </code>
Line 44: Line 46:
     Username = string.gsub(Username, "@company%.com$", "");     Username = string.gsub(Username, "@company%.com$", "");
          
-    return username;+    return Username;
 end end
 </code> </code>
Line 50: Line 52:
  
 If you need, we can produce a script for you, but there would be a cost for this - contact [[support@pscs.co.uk]] with a specification for a quote. If you need, we can produce a script for you, but there would be a cost for this - contact [[support@pscs.co.uk]] with a specification for a quote.
 +
 +
 +====ProcessCopySettings====
 +
 +If a user is created with a copy of someone's settings, this function is called to allow filtering/processing of copied settings
 +
 +  function ProcessCopySettings(newUser, newSettings, newAllowedSenderAddresses, copiedUser, copiedSettings, copiedAllowedSenderAddresses)
 +
 +  * newUser = new user name
 +  * newSettings = copied settings to be applied to the new user after basic preprocessing (eg changes of some sender email address settings where an 'obvious' change is possible
 +  * newAllowedSenderAddresses = copied 'Allowed sender addresses' to be applied after basic preprocessing
 +  * copiedUser = user name which has been copied
 +  * copiedSettings = settings of the user which has been copied (no processing)
 +  * copiedAllowedSenderAddresses = 'Allowed sender addresses' of the user which has been copied (no processing)
 +
 +returns newSettings, newAllowedSenderAddresses 
reference/user_manager_script.1713775030.txt.gz · Last modified: by paul