final move of files
[web.mtrack] / MTrack / Interface / Auth.php
1 <?php 
2
3 interface IMTrackAuth
4 {
5   /** Returns the authenticated user, or null if authentication is
6    * required */
7   function authenticate();
8
9   /** Called if the user is not authenticated as a registered
10    * user and if the page requires it.
11    * Should initiate whatever is appropriate to begin the authentication
12    * process (eg: displaying logon information).
13    * You may assume that no output has been sent to the client at
14    * the time that this function is called.
15    * Returns null if not supported, throw an exception if failed,
16    * else return a the authenticated user (if it can be determined
17    * by the time the function returns).
18    * If an alternate login page is displayed, this function should
19    * exit instead of returning.
20    */
21   function doAuthenticate($force = false);
22
23   /** Returns a list of available groups.
24    * Returns null if not supported, throw an exception if failed. */
25   function enumGroups();
26
27   /** Returns a list of groups that a given user belongs to.
28    * Returns null if not supported, throw an exception if failed. */
29   function getGroups($username);
30
31   /** Adds a user to a group.
32    * Returns null if not supported, throw an exception if failed,
33    * return true if succeeded */
34   function addToGroup($username, $groupname);
35
36   /** Removes a user from a group.
37    * Returns null if not supported, throw an exception if failed,
38    * return true if succeeded */
39   function removeFromGroup($username, $groupname);
40
41   /** Returns userdata for a given user id
42    * Some authentication mechanisms outsource the storage of user data.
43    * This function returns null if no additional information is available,
44    * or an array containing the following keys:
45    *   email - the email address
46    *   fullname - the full name
47    *   avatar - URL to an avatar image
48    */
49   function getUserData($username);
50 }