From d45df55af33046d793230221039222556827d46d Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sat, 22 Sep 2007 18:13:08 +0000 Subject: updated documents to prosilver style git-svn-id: file:///svn/phpbb/trunk@8097 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/auth_api.html | 377 ++++++++++++++++------------------------------- 1 file changed, 123 insertions(+), 254 deletions(-) (limited to 'phpBB/docs/auth_api.html') diff --git a/phpBB/docs/auth_api.html b/phpBB/docs/auth_api.html index f744466254..c83aaadc2d 100644 --- a/phpBB/docs/auth_api.html +++ b/phpBB/docs/auth_api.html @@ -1,191 +1,60 @@ - - + + -Auth API - - + + + + + - - - - - - - - - - + + + + +phpBB3 • Auth API + + - + - +
+ + + + -
+
-

This is an explanation of how to use the phpBB auth/acl API.

+ -

Auth API

+

This is an explanation of how to use the phpBB auth/acl API.

-
- Top -

-
+
+ +

2. Methods

+ +
+
-

2. Methods

+

Following are the methods you are able to use.

- 2.i. acl -

-
+

2.i. 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 an associative array containing user information as stored in the database. This array must contain at least the following information; user_id, user_permissions and user_type. It is called in the following way:

-
+	
 $auth->acl(userdata);
-	
+

Where userdata is the array containing the aforementioned data.

-
- Top -

- - - 2.ii. acl_get -

-
+

2.ii. acl_get

This method is the primary way of determining what a user can and cannot do for a given option globally or in 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. By adding a ! in front of the option, e.g. '!f_list' the result of this method will be negated. The optional forum term is the integer forum_id.

@@ -263,121 +139,114 @@ $result = $auth->acl_get(option[, forum]);

There are some special options or flags which are used as prefixes for other options, e.g. 'f_' or 'm_'. These flags will automatically be set to a positive integer if the user has one or more permissions with the given prefix. A local setting will result in the flag being set only locally (so it will require a forum id to retrieve). If a user has one or more global permissions with the prefix acl_get will return a positive integer regardless of the forum id.

-
- Top -

- - - 2.iii. acl_gets -

-
+

2.iii. 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.

The method will return a positive integer if acl_get for one of the options evaluates to a positive integer (combines permissions with OR).

-
- Top -

- - - 2.iv. acl_getf -

-
+

2.iv. acl_getf

This method is used to find out in which forums a user is allowed to carry out an operation or to find out in which forums he is not allowed to carry out an operation. The method should be called in the following way:

-
+	
 $result = $auth->acl_getf(option[, clean]);
-	
+

Just like in the acl_get method the option is a string specifying the permission which has to be checked (negation using ! is allowed). The second parameter is a boolean. If it is set to false this method returns all forums with either zero or a positive integer. If it is set to true only those forums with a positive integer as the result will be returned.

The method returns an associative array of the form:

-
+	
 array(forum_id1 => array(option => integer), forum_id2 => ...)
-	
+

Where option is the option passed to the method and integer is either zero or a positive integer and the same acl_get(option, forum_id) would return.

-
- Top -

- - - 2.v. acl_getf_global -

-
+

2.v. acl_getf_global

This method is used to find out whether a user has a permission in at least one forum or globally. This method is similar to checking whether acl_getf(option, true) returned one or more forums but it's faster. It should be called in the following way:

-
+	
 $result = acl_getf_global(option)
-	
+

As with the previous methods option is a string specifying the permission which has to be checked.

This method returns either zero or a positive integer.

- - Top -

+

2.vi. 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.

- 2.vi. 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.

+
Back to Top
+ - Top -

-
+
-

3. Admin related functions

+

3. 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 separate class, auth_admin. This can be found in includes/acp/auth.php.

To use any methods this class contains it first needs to be instantiated separately from auth. This is achieved in the same way as auth:

-
+	
 $auth_admin = new auth_admin();
-	
+

This instance gives you access to both the methods of this specific class and that of auth.

+
+ + + +
- Top -


-

4. Copyright and disclaimer

+

4. Copyright and disclaimer

+
+ +

This application is opensource software released under the GPL. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) 2000, 2002, 2005, 2007 phpBB Group, All Rights Reserved.

-
-Top +
-
+
Back to Top
+ + + + + + + + -