Difference between revisions of "NATS4 Site User Management"
TmmStephen (talk | contribs) |
|||
Line 93: | Line 93: | ||
case 'ADD': | case 'ADD': | ||
+ | add_user(); | ||
+ | break; | ||
+ | |||
+ | /** | ||
+ | * Additional parameters: memberid, username, password, email, siteid, biller, trial | ||
+ | * This call is done whenever a new username should be added to the user management for access. | ||
+ | * This is generally done when reactivating someone who has been removed. | ||
+ | */ | ||
+ | |||
+ | case 'ACTIVATE': | ||
add_user(); | add_user(); | ||
break; | break; |
Revision as of 12:26, 31 December 2009
NATS can send a postback a script every time a username gets added, removed, changed, expired, or checked. Go to Sites Admin, edit a tour, and enter the script's URL in the Management URL field.
Each request identifies the username action. You script should reply with one of the following messages:
- OK|message
- NOTOK|message
- ERROR|message
Replace message with a detailed explanation.
Username Actions
ADD
Sent when a new username should be added to the user management system. Sends the following extra parameters: memberid, username, password, email, siteid, biller, trial.
MANUALADD
Sent when a username is manually added via the members admin or a biller refresh. Sends the following extra parameters: memberid, username, password, siteid, biller, trial.
ACTIVATE
Send when a username has rebilled at the biller. Used to record a rebill or convert a member from a trial membership to a full membership. Sends the following extra parameters: memberid, username, password, siteid, biller, trial.
TRIALTOFULL
Sent when a user changes from trial to full membership. Sends the following extra parameters: memberid, username, siteid, biller.
Note: this might be run more than once for a conversion.
CHANGE
Sent when a current username or password should be changed to a new username or password. Sends the following extra parameters: memberid, username, siteid, biller, new_username, new_password.
DELETE
Sent when a user's account should be immediately removed from the active user list. Sends the following extra parameters: memberid, username, siteid, biller.
EXPIRE
Sent when a user's account should be expired on the provided date. The date might be in the past. Sends the following extra parameters: memberid, username, siteid, biller, expire (YYYY-MM-DD format).
CHECK
Sent to check if a username is available.
NOTE: If the username does exist, the reply should be OK. If the username does not exist, the reply should be NOTOK.
Sends the following extra parameters: username, siteid.
Error Logging
If the reply is ERROR, NATS adds the error to the surfer's note so you can see the problem the Members Admin.
Sample Script
You may use the following sample script provided by Tanguy de Courson.
/** * A password authentication script for the NATS user management feature * where NATS posts the authentication to your authentication script * * NB: all functions MUST print out * OK|~message~ * or * NOTOK|~message~ * or * ERROR|~message~ * * @author Tanguy de Courson * **/ switch(@$_REQUEST['action']) { /** * Additional parameters: memberid, username, password, email, siteid, biller, trial * This call is done whenever a new username should be added to the user management for access. */ case 'ADD': add_user(); break; /** * Additional parameters: memberid, username, password, email, siteid, biller, trial * This call is done whenever a new username should be added to the user management for access. * This is generally done when reactivating someone who has been removed. */ case 'ACTIVATE': add_user(); break; /** * Additional parameters: memberid, username, password, siteid, biller, trial * This call is done whenever a username is manually added via the members admin or a biller refresh. **/ case 'MANUALADD': add_user(); break; /** * Additional parameters: memberid, username, siteid, biller * This call is done whenever a user changes from trial to full membership. **/ case 'TRIALTOFULL': upgrade_user(); break; /** * Additional parameters: memberid, username, siteid, biller, new_username, new_password * This call is done whenever an old username should be updated to a new username and/or password. **/ case 'CHANGE': change_password(); break; /** * Additional parameters: memberid, username, siteid, biller * This call is done whenever a current user should be immediately removed from the active user list. **/ case 'DELETE': delete_user(); break; /** * Additional parameters: memberid, username, siteid, biller, expire (YYYY-MM-DD format) * This call is done when a current user should be expired on a given date. The date MIGHT be in the past. **/ case 'EXPIRE': expire_user(); break; /** * Additional parameters: username, siteid * This call is done to verify if a username is still available. If the username DOES exist, the reply should be OK. If the username DOES NOT exist, the reply should be NOTOK. **/ case 'CHECK': check_user(); break; } function add_user() { } function upgrade_user() { } function change_password() { } function delete_user() { } function expire_user() { } function check_user() { }