phpBB

Development Wiki

Tutorial.Permissions

From phpBB Development Wiki

Revision as of 08:47, 26 August 2007 by ZgwCuu (Talk | contribs)

foto donne grasse nere porche donne e dipendenza dal lavoro sfondo canalis dante paradiso riassunto canto xxxiii www sex culo it roxana diaz porno eros gratutiti go go very sexy show video salsa gratis madonna sexy sexo profesional baila sexy thing donne in cerca damore foto transex grtais porno exitantes vedo nudo locali gay l tarzana sesso selvaggio george beer anziani gay foto galleria twin snakes porno incinte gay web foto gratis pompini sessogay dyson, edward george lesbo stivali hentay sailor moon lesbo racconti ipergratis loghi sex sesso forum immagini transessuali japanese sex foto di donne mature teenager sesso girl fuck rollergirl video gratis de michelle vieth xxx le foto sexy di garko club sex www paolaechiara britney spears xxx nudoty famiglia incestuosa immagini tettone gratis sex termometer haiduci xxx fontana canalis show girl croata experimento caseros videos de porno saudi sesso eva robinson nuda xxxx sex canale5 www donne mature it www adultswim mature xxx ragazze russe eurosex nuda gol video foto nuda annalisa caputo sexfilm gayromeo sorella racconti erotici sexy parodius donne grasse nude will you be my girl helicopteros sesso hot nudiste film amatoriale porno foto di ragazze anoressiche topless tennis serena dandini nuda scopate di cvalli con donne george weasley im too gratis www sexso com calimero dance gratis fuck it female gratis pics porno 70 festo gay cavalier xgirls lulu transex donne per singoli casalinghe sexy uomo che fa sesso webcam gay anal fisting max deangelis nuda sesso cavalli calendario nuda suonerie gratis da scaricare polisex sexywomen foto e video disesso siti erotici tv terrestre analogico donne nude sexuality ginnasta nuda videos gratis de sexo racconti di orgasmi pullman, george mortimer giochini gratis myfirstsexteacher com britney spears porno gay palestrati il sesso degli angeli www sexool com sexy jeans hard porno donkey sexs film pornografici nudo uomo www wordlsex www sexycoppie it george, pierre hentai flash non scherzare con le donne - i galli del mare shakira total mente desnuda teen sex videos filmati gratis porno donne belissime duncan nudo sophie ellis bextor nuda www bolognaeros com psycho girl donne 47enne kragujevac porno le brave donne di bangkok suonerie gratis sfondi gratis motorola pamela anderson calendario margot sikabonyi nuda lola ponce nuda aria giovanni foto porno girlie nite out giochi java gratis anna la rosa nuda transex con telefono musica classica gratis disegni gratis burro programmazione settimanale atletica legg midi file sequenze da scaricare gratis talia desnuda katia gf4 sexy videos pono xxx de acceso facil invio gratis sms fuckyou gun shy - un revolver in analisi nudo pitt integrale posizioni x fare sesso angela finocchiaro nuda video porno britney spears xena tutta nuda foto donne porche over 50 videos gratis de orgasmos femeninos sfondo gratis pc giochi da scaricare gratis xxx eamon fuck it video canaletta ghisa guanti donne donne venezuelane a napoli web cam live show erotic gratis sex girls vree saint george analisi web peliculas prono gratis spycam in bagni e hotel gratis ragazze oslo porno market free mpeg fuck in pantyhose partituras gratis playboy foto gay cam galleria video porno di oggi celebrita a piedi nudi porno video free mess gratis showgirl italiana j m video clip sex sabrina ferilli completamente nuda previsioni lotto gratis good girl uomini nudi col pisello soca girlz fotos mujer desnuda free somali sexy girl sexy older women girls flashing video gratis pompini annunci per adulti flash porno foto nudo maschile pamela anderson video hard download grat due cazzi e una pornostar == Checking permissions ==

Global perission

To check if user can for example view other users profiles, use this code:

if (!$auth->acl_get('u_viewprofile'))
{
     
trigger_error('NOT_AUTHORIZED');
}

If he doesn't have permission to do it, he will see only error message and script will stop working after trigger_error.

Local permission

If you want to check a local permission, for example to read posts on forum with ID 5, use this code:

if (!$auth->acl_get('f_read'5))
{
     
trigger_error('NOT_AUTHORIZED');
}

Full list of existing permissions is in your database, in phpbb_acl_options table.

Adding a permission

Adding new permissions to Olympus is simple. NOTE: The permission can not contain a capital letter, this causes trouble later on if you try and create a module that needs this permission Example how to add a permission to control who can access and manage foo:

Using the API (recommended)

  • Run this code in the installer:
<?php
// Setup $auth_admin class so we can add permission options
include($phpbb_root_path 'includes/acp/auth.' $phpEx);
$auth_admin = new auth_admin();

// Add permissions
$auth_admin->acl_add_option(array(
    
'local'      => array(),
    
'global'   => array('u_view_foo''u_manage_foo')
));
?>

Using SQL

You can also directly insert new rows into the phpbb_acl_options table:

INSERT INTO phpbb_acl_options (auth_option, is_global, is_local, founder_only) VALUES ('u_view_foo', 1, 0, 0);
INSERT INTO phpbb_acl_options (auth_option, is_global, is_local, founder_only) VALUES ('u_manage_foo', 1, 0, 0);

Please note that you need to clear the cache by either deleting cache/data_global.php or executing $cache->destroy('acl_options'); after this.

Language file (Adding tabs)

In both cases it is highly recommended to add language variables for the permissions just added. To do this, simply create a file named permissions_foo.php in language/xx/mods. It will automatically be included, don't worry about how.

<?php
/**
* DO NOT CHANGE
*/
if (empty($lang) || !is_array($lang))
{
    
$lang = array();
}

// DEVELOPERS PLEASE NOTE
//
// All language files should use UTF-8 as their encoding and the files must not contain a BOM.
//
// Placeholders can now contain order information, e.g. instead of
// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows
// translators to re-order the output of data while ensuring it remains correct
//
// You do not need this where single placeholders are used, e.g. 'Message %d' is fine
// equally where a string contains only two placeholders which are used to wrap text
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine

// Adding new category
$lang['permission_cat']['foo'] = 'Foo management';

// Adding the permissions
$lang array_merge($lang, array(
    
'acl_u_view_foo'    => array('lang' => 'Can view foo''cat' => 'foo'),
    
'acl_u_manage_foo'    => array('lang' => 'Can manage foo''cat' => 'foo'),
));
?>

In this code they added the category "foo" (will be displayed as a new tab). All language keys where the key cat is equal to "foo" will be displayed in this tab. So you have created an new tab if you use that code.

The permission should be ready to assign to users/groups in the acp now. To check whether the logged in user has the nescessary permission to view foo, use this code:

if (!$auth->acl_get('u_view_foo'))
{
     
trigger_error('NOT_AUTHORIZED');
}

Panels (in the ACP)

To get the permission to show up under the right panel you need to use correct naming.

a_foo_bar Administrator permissions panel
m_foo_bar 
Moderator permissions panel
u_foo_bar 
User permissions panel
f_foo_bar 
Forum permissions panel

If you use the correct naming and give the permission a category in the language file as described above the permission will show in the selected panel.

Permission types