Note:


The auth module contains two functions for authentication management.




Permissions in Templeet

Permissions in Templeet are managed area by area. An area is a set of pages accessible with specific permissions for that area. Each area has a name defined in the authentication managment tool:

New area can be created:

Users have permissions going from 0 (no permission at all) to 10 for each existing area. These permissions can be changed with the interface: http://rootix.free.fr/templeet.php?auth/

Administrators have all permissions.
Users can have permissions for editing areas which means they can give permissions for these areas to other users.
Also, they can have permissions to delegate permissions for editing areas to other users.

~getauth()

This function protects pages. It must be called at the beginning of templates.
Function ~getauth() takes 4 parameters : area name, requested privilege level, authentication page and insufficient privilege level.

To view a page protected by this function, users must have a permission level for that area greater or equal than the permission level requested.

In the following example users must have a permission level greater or equal to 5 on area 'areaA' to view pages protected with that code:

~getauth('areaA',5,"my_account/authform.html","my_account/nopriv.html")



Administrators have a privilege level of 1 on the ADMIN area. Permissions on that area can be 0 (not an administrator) or 1 for administrators. The following code protects pages and allow viewing for administrators only:

~getauth('ADMIN',1,"my_account/authform.html","my_account/nopriv.html")



~getauth() can also request an authentication without specific privileges requested. You only have to authentify to view a page protected that way:

~getauth('',0,"my_account/authform.html","my_account/nopriv.html")



In some cases, you may want to know if the user is logged in and who he is.

~getauth('',-1)



~getpriv()

This function retrieves the privilege level of the user for the area in parameter. You can use it to change the look of menus and adapt them to the rights the user logged in has.

~if(~getpriv('EDITOR'),'<a href="edit.html">edit</a>')


auth_user variable

This variable contains the name of the authentified user.

~getauth('',-1) <!-- getauth call is necessary to initialise auth_user variable -->
.
.
.
~if(~get('auth_user')!='',
'Your login is ~get('auth_user')',
'You\'re not authentified')