You can use the "access" command to restrict access to web site contents.
access {
display "Welcome, {sys%auth:username}.<br>\n";
display "Have a good day, {sys%auth:GivenName} {sys%auth:Surname}.\n";
} else {
display "Member only page, please login first.\n";
}
(sys%auth:username is the logged in username, and sys%auth:GivenName and sys%auth:Surname are arbitrary fields in the authentication table.)
In the above example, visitors logged in will see the first block. All others will see the second. The second block is optional. ("access" is internally implemented as "if", so either "else" or "elseif" can start a second block after the "access" block.)
You can selectively restrict access to a particular level of users:
access (member) {
// "member" privilege or higher
// ...
}
You can even discriminate on user or realm:
access (@marketing) {
// All users in the "marketing" realm
display "Reminder: Please send in 3rd quarter report!\n";
} else access (john@) {
// User "john" in the blank realm (default realm)
display "John, please call your wife.\n";
} else access (mary@sales) {
// User "mary" in the "sales" realm
display "Mary, November volume was up. Well done!\n";
} else access (not @service) {
// All users except those in the "service" realm
display "Service finally lost their bowling title to Purchasing!\n";
} else {
// Everybody else
display "No news is good news\n";
}
|