# Using the auth class ## What is it? The auth class contains methods related to authorisation users to access various board functions, e.g. posting, viewing, replying, logging in (and out), etc. If you need to check whether a user can carry out a task or handle user login/logouts this class is required. ## Initialisation To use any methods contained with the auth class it first needs to be instantiated. This is best achieved early in the execution of the script in the following manner:
    $auth = new auth();
Once an instance of the object has been created you are free to call the various methods it contains. Please note that should you wish to use the auth_admin methods you will need to instantiate this seperately but in the same way. ### acl The acl method is the initialisation routine for all the acl functions. If you intend calling any acl method you must first call this. The method takes as its one and only required parameter a hash of userdata. This hash must contain at least the following information; user_id, user_permissions and user_founder. It is called in the following way:
    $auth->acl(userdata);
Where userdata is the hash containing the aforementioned data. ### acl_get This method is the primary way of determining what a user can and cannot do for a given option in, optionally, a given forum. The method should be called in the following way:
    $result = $auth->acl_get(option[, forum]);
Where option is a string representing the required option, e.g. 'f_list', 'm_edit', 'a_adduser', etc. The optional forum term is the integer forum_id. ### acl_gets This method is funtionally similar to acl_get in that it returns information on whether a user can or cannot carry out a given task. The difference here is the ability to test several different options in one go. This may be useful for testing whether a user is a moderator or an admin in one call. Rather than having to call and check acl_get twice. The method should be called thus:
    $result = $auth->acl_gets(option1[, option2, ..., optionN, forum]);
As with the acl_get method the options are strings representing the required permissions to check. The forum again is an integer representing a given forum_id. ### acl_cache This should be considered a private method and not be called externally. It handles the generation of the user_permissions data from the basic user and group authorisation data. When necessary this method is called automatically by acl. ### login ## Admin related functions A number of additional methods are available related to auth. These handle more basic functions such as adding user and group permissions, new options and clearing the user cache. These methods are contained within a seperate class, auth_admin. This can be found in the functions_admin source. To use any methods this class contains it first needs to be instantiated seperately from auth. This is achieved in the same way as auth:
    $authadmin = new auth_admin();
This instance gives you access to both the methods of this specific class and that of auth.