This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| reference:user_manager_script [2024/04/22 09:37] – paul | reference: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 ' | + | The Lua script is managed through the Settings → Scripts page in VPOP3 v8.0 and later and is called ' |
| + | |||
| + | ====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 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 | + | return |
| end | end | ||
| </ | </ | ||
| Line 44: | Line 46: | ||
| Username = string.gsub(Username, | Username = string.gsub(Username, | ||
| | | ||
| - | return | + | return |
| end | end | ||
| </ | </ | ||
| 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' | ||
| + | |||
| + | function ProcessCopySettings(newUser, | ||
| + | |||
| + | * 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 ' | ||
| + | * newAllowedSenderAddresses = copied ' | ||
| + | * copiedUser = user name which has been copied | ||
| + | * copiedSettings = settings of the user which has been copied (no processing) | ||
| + | * copiedAllowedSenderAddresses = ' | ||
| + | |||
| + | returns newSettings, | ||