phpBB

Development Wiki

Difference between revisions of "Tutorial.Permissions"

From phpBB Development Wiki

m
Line 1: Line 1:
== Checking permissions ==
+
[http://ustall.org/web/graduatoria-sostegno.htm graduatoria sostegno caserta] [http://psisemiya.com/images/small/acquisto-mobili/ acquisto mobili ufficio usati] [http://saibso.org/trapani-venezia.htm trapani venezia biglietti aerei] [http://davte.info/library/html/mixer-.htm mixer 6 canali] [http://amohseni.info/img/styles/tre-per/ tre per uccidere] [http://kinunia.cn/lvov.htm lvov] [http://kinunia.cn/la-morte.htm la morte corre incontro a jessica] [http://kinunia.cn/universita-economia.htm universita economia e commercio torino] [http://psisemiya.com/images/small/kn-e/ k8n e deluxe] [http://davte.info/library/html/hyundai-bologna.htm hyundai bologna] [http://ustall.org/web/club-net.htm club net] [http://amohseni.info/img/styles/budha-bar/ budha bar] [http://nobinters.org/carica-batteria.htm carica batteria solare] [http://kinunia.cn/wellness-isernia.htm wellness isernia] [http://nobinters.org/lybra-km.htm lybra km zero] [http://ustall.org/web/regione-siciliana.htm regione siciliana it] [http://amohseni.info/img/styles/ludmilla-radchenko/ ludmilla radchenko] [http://ashythro.info/library/html/vianello-tommaso/ vianello tommaso] [http://psisemiya.com/images/small/nikkor-af/ nikkor af nikon af-s vr 24-120 mm f] [http://ustall.org/web/fiat-sava.htm fiat sava] [http://psisemiya.com/images/small/amphetadesk/ amphetadesk] [http://kinunia.cn/kodoku.htm kodoku] [http://ustall.org/web/bluetooth-monitor.htm bluetooth monitor] [http://kinunia.cn/funkytown.htm funkytown] [http://psisemiya.com/images/small/mirino-angolare/ mirino angolare] [http://kinunia.cn/dizionario-inglese.htm dizionario inglese italiano free] [http://nobinters.org/trio-bebe.htm trio bebe confort] [http://psisemiya.com/images/small/fastweeb-it/ fastweeb it] [http://ashythro.info/library/html/x-change/ x change] [http://amohseni.info/img/styles/francisca/ francisca] [http://bloprofeldi.info/lib/dimage-z.htm dimage z5 nera] [http://bloprofeldi.info/lib/casse-da.htm casse da studio] [http://amohseni.info/img/styles/stampante-fotografica/ stampante fotografica professionale hp] [http://ashythro.info/library/html/carlo-cracco/ carlo cracco libri] [http://ustall.org/web/un-uomo.htm un uomo da buttare] [http://helmed.info/topic/calcio-ps/ calcio ps2 videogiochi] [http://ashythro.info/library/html/www-navy/ www navy it] [http://kinunia.cn/lightnining.htm lightnining] [http://chaba.info/sopra-e/ sopra e sotto il ponte] [http://nobinters.org/hifi.htm hifi 5 1] [http://nobinters.org/filmati-hard.htm filmati hard selen gratis] [http://helmed.info/topic/hard-disc/ hard disc iomega 250gb firewire] [http://psisemiya.com/images/small/gerico/ gerico 2004] [http://kinunia.cn/boogyman.htm boogyman] [http://helmed.info/topic/coltivazione-della/ coltivazione della marjuana] [http://ustall.org/web/modena-wireless.htm modena wireless racing wheel] [http://nobinters.org/tenda-.htm tenda 3 persone] [http://kinunia.cn/tubo-gas.htm tubo gas] [http://nobinters.org/imate-.htm i-mate - jam gps] [http://ustall.org/web/nissan-micra.htm nissan micra 1.3] [http://chaba.info/pamela-cartoni/ pamela cartoni] [http://chaba.info/sun-ktv/ sun ktv] [http://amohseni.info/img/styles/sharik/ sharik] [http://helmed.info/topic/hoge-veluwe/ hoge veluwe] [http://psisemiya.com/images/small/mercanteinfiera-a/ mercanteinfiera a parma] [http://psisemiya.com/images/small/imponente/ imponente] [http://kinunia.cn/sulla-strada.htm sulla strada jack kerouac libri] [http://davte.info/library/html/ambulanze-usate.htm ambulanze usate] [http://kinunia.cn/garboli.htm garboli] [http://ashythro.info/library/html/villaggio-turistici/ villaggio turistici puglia] [http://ashythro.info/library/html/dido-video/ dido video white flag] [http://ashythro.info/library/html/dvd-verbatim/ dvd verbatim datalife plus azo] [http://nobinters.org/fbi-protezione.htm fbi protezione testimoni] [http://helmed.info/topic/auto-noleggio/ auto noleggio bolzano] [http://nobinters.org/panchiao.htm panchiao] [http://ashythro.info/library/html/wuthering-heights/ wuthering heights] [http://chaba.info/last-minute/ last minute rodi] [http://ashythro.info/library/html/cavo-usb/ cavo usb fujifilm] [http://ustall.org/web/gallerie-fotografiche.htm gallerie fotografiche gratuite tettone m] [http://helmed.info/topic/ci-sarai/ ci sarai fracesco renga] [http://davte.info/library/html/lora-della.htm lora della furia] [http://davte.info/library/html/sophia-loren.htm sophia loren] [http://ustall.org/web/palmare-gprs.htm palmare gprs microsoft] [http://psisemiya.com/images/small/ordu-provincia/ ordu (provincia)] [http://bloprofeldi.info/lib/gig-dalessio.htm gig dalessio cd cover] [http://davte.info/library/html/manga-com.htm manga com] [http://bloprofeldi.info/lib/traduzione-last.htm traduzione last thing on my mind] [http://amohseni.info/img/styles/tylko-czarne/ tylko czarne oczy] [http://chaba.info/teh-reason/ teh reason] [http://amohseni.info/img/styles/principio-speranza/ principio speranza] [http://amohseni.info/img/styles/amd-athlon/ amd athlon64 3200 (socket 939)] [http://nobinters.org/la-farfalla.htm la farfalla come animale] [http://saibso.org/le-ragazze.htm le ragazze dei quartieri alti] [http://kinunia.cn/auto-eten.htm auto eten] [http://psisemiya.com/images/small/crono-belt/ crono belt] [http://bloprofeldi.info/lib/begees.htm begees] [http://bloprofeldi.info/lib/avvitatore-ad.htm avvitatore ad aria] [http://saibso.org/mazonaki.htm mazonaki] [http://amohseni.info/img/styles/linksys-adapter/ linksys adapter] [http://chaba.info/ags-tecnica/ ags (tecnica)] [http://chaba.info/dentaria/ dentaria] [http://helmed.info/topic/la-commissaria/ la commissaria] [http://ashythro.info/library/html/inserimento-annunci/ inserimento annunci] [http://chaba.info/gigabyte-knsc/ gigabyte k8nsc nforce3] [http://psisemiya.com/images/small/assicurazione-varazze/ assicurazione varazze] [http://chaba.info/luoghi-allaperto/ luoghi allaperto] [http://davte.info/library/html/copione-de.htm copione de i cento passi] [http://chaba.info/del-mariachi/ del mariachi] [http://helmed.info/topic/pagina-erotica/ pagina erotica] [http://ustall.org/web/sei-speciale.htm sei speciale] [http://bloprofeldi.info/lib/km-opel.htm km0 opel meriva auto km 0] [http://psisemiya.com/images/small/mp-latin/ mp3 latin pop] [http://bloprofeldi.info/lib/pannolini-huggies.htm pannolini huggies] [http://kinunia.cn/t-ericsson.htm t66 ericsson] [http://davte.info/library/html/mappa-stradale.htm mappa stradale] [http://psisemiya.com/images/small/nudi-gratis/ nudi gratis] [http://ustall.org/web/acer-n.htm acer n35 accessori] [http://nobinters.org/baby-pratik.htm baby pratik] [http://chaba.info/occupazione/ occupazione] [http://helmed.info/topic/nude-cristina/ nude cristina aguilera] [http://psisemiya.com/images/small/israel-kamakawiwo/ israel kamakawiwo ole mp3 free] [http://saibso.org/blan-biliardo.htm blan biliardo] [http://chaba.info/carnielli-tapis/ carnielli tapis roulant] [http://saibso.org/paolo-meneguzzi.htm paolo meneguzzi testi] [http://helmed.info/topic/just-the/ just the wai yuo are barry white] [http://kinunia.cn/atletica-leggera.htm atletica leggera] [http://bloprofeldi.info/lib/rex-combinato.htm rex combinato a] [http://davte.info/library/html/dibujos-tridimensionales.htm dibujos tridimensionales] [http://kinunia.cn/camper-vendesi.htm camper vendesi] [http://ashythro.info/library/html/bagliori-di/ bagliori di guerra] [http://kinunia.cn/istituto-salvemini.htm istituto salvemini] [http://chaba.info/tim-miss/ tim miss motorola] [http://bloprofeldi.info/lib/offerta-auto.htm offerta auto km 0] [http://psisemiya.com/images/small/sei-colpi/ sei colpi in canna] [http://bloprofeldi.info/lib/touareg-.htm touareg 3.0 tdi] [http://ashythro.info/library/html/mmc-mb/ mmc 512mb dual voltage] [http://ustall.org/web/ricevitore-gps.htm ricevitore gps blutooth] [http://ashythro.info/library/html/freepops/ freepops] [http://bloprofeldi.info/lib/fangcheng.htm fangcheng] [http://saibso.org/el-organo.htm el organo] [http://amohseni.info/img/styles/palmare-con/ palmare con telefono e fotocamera] [http://nobinters.org/televisore-multistandard.htm televisore multistandard] [http://bloprofeldi.info/lib/dvd-mannoia.htm dvd mannoia] [http://psisemiya.com/images/small/lettere-da/ lettere da amore] [http://ustall.org/web/creed-my.htm creed my sacrifice] [http://bloprofeldi.info/lib/natalia-millan.htm natalia millan] [http://nobinters.org/valentina-uomini.htm valentina uomini e donne] [http://ashythro.info/library/html/lovale/ lovale] [http://chaba.info/sodomia-/ sodomia - la visita del vicino] [http://saibso.org/eiffel-.htm eiffel 65 another way] [http://bloprofeldi.info/lib/sandisk-mp.htm sandisk mp3] [http://nobinters.org/apple-ipod.htm apple ipod mini (6 gb)] [http://amohseni.info/img/styles/www-ragazze/ www ragazze nigeriane it] [http://nobinters.org/ritornerai.htm ritornerai] [http://ustall.org/web/gaggia-espresso.htm gaggia espresso] [http://saibso.org/paola-e.htm paola e chiara cantanti nude] [http://saibso.org/usb-flash.htm usb flash mp3] [http://bloprofeldi.info/lib/samsung-miniket.htm samsung miniket vp] [http://nobinters.org/ivette-sangalo.htm ivette sangalo] [http://davte.info/library/html/lettore-di.htm lettore di schede sandisk] [http://saibso.org/sai-tenere.htm sai tenere un segreto] [http://saibso.org/pioneer-dehmp.htm pioneer deh-4700mp] [http://kinunia.cn/varsavia-cose.htm varsavia cose fare] [http://ustall.org/web/viava-la.htm viava la pappa] [http://amohseni.info/img/styles/negozi-di/ negozi di bomboniere campania] [http://kinunia.cn/di-silvester.htm di silvester stallone] [http://davte.info/library/html/korea-sex.htm korea sex video] [http://helmed.info/topic/milano-mosca/ milano mosca] [http://davte.info/library/html/xd-olympus.htm xd olympus 128mb] [http://nobinters.org/camini-e.htm camini e stufe] [http://nobinters.org/i-cavalieri.htm i cavalieri dello zodiaco] [http://nobinters.org/baby-can.htm baby can i hold you tonight] [http://davte.info/library/html/panini-spa.htm panini spa] [http://saibso.org/witch-hunter.htm witch hunter robin. vol. 05] [http://chaba.info/www-dolce/ www dolce e gabbana] [http://nobinters.org/affittacamere-lucca.htm affittacamere lucca] [http://ustall.org/web/lacafetera.htm lacafetera] [http://ustall.org/web/larva.htm larva] [http://kinunia.cn/gatitas.htm gatitas] [http://kinunia.cn/annunci-ragazze.htm annunci ragazze vogliose] [http://nobinters.org/fujifilm-finepix.htm fujifilm finepix f610] [http://nobinters.org/lupen-fisarmonica.htm lupen fisarmonica] [http://kinunia.cn/il-teatro.htm il teatro di john keats] [http://ashythro.info/library/html/celeron-d/ celeron d 336] [http://amohseni.info/img/styles/loewe-spheros/ loewe spheros 37 hd] [http://nobinters.org/www-finanze.htm www finanze] [http://ashythro.info/library/html/mitsubishi-condizionatori/ mitsubishi condizionatori trial] [http://ashythro.info/library/html/cavo-surround/ cavo surround] [http://helmed.info/topic/qvr-casio/ qv-r52 casio] [http://ustall.org/web/confort-trio.htm confort trio] [http://davte.info/library/html/firenze-zurigo.htm firenze zurigo biglietti aerei] [http://bloprofeldi.info/lib/centri-urbani.htm centri urbani] [http://psisemiya.com/images/small/de-bary/ de bary, heinrich anton] [http://davte.info/library/html/banconota-italiane.htm banconota italiane] [http://ashythro.info/library/html/nike-solas/ nike solas air] [http://davte.info/library/html/www-caravanbacci.htm www caravanbacci it] [http://chaba.info/foto-annunci/ foto annunci singole donne amanti anal] [http://amohseni.info/img/styles/amapola-com/ amapola com] [http://saibso.org/lettore-cd.htm lettore cd radio] [http://chaba.info/calcolo-indennita/ calcolo indennita occupazione] [http://nobinters.org/hyundai-p.htm hyundai 201p] [http://psisemiya.com/images/small/hard-disk/ hard disk portatile lettore memory card] [http://chaba.info/scuola-per/ scuola per estetista] [http://saibso.org/f.htm f410] [http://chaba.info/ever-/ ever 2005 q] [http://kinunia.cn/cd-britney.htm cd britney spears] [http://amohseni.info/img/styles/le-bouton/ le bouton d or] [http://helmed.info/topic/panasonic-lumix/ panasonic lumix 30] [http://saibso.org/virgilio-mail.htm virgilio mail] [http://chaba.info/ghost-norton/ ghost norton] == Checking permissions ==
  
 
=== Global perission ===
 
=== Global perission ===

Revision as of 17:24, 17 August 2007

graduatoria sostegno caserta acquisto mobili ufficio usati trapani venezia biglietti aerei mixer 6 canali tre per uccidere lvov la morte corre incontro a jessica universita economia e commercio torino k8n e deluxe hyundai bologna club net budha bar carica batteria solare wellness isernia lybra km zero regione siciliana it ludmilla radchenko vianello tommaso nikkor af nikon af-s vr 24-120 mm f fiat sava amphetadesk kodoku bluetooth monitor funkytown mirino angolare dizionario inglese italiano free trio bebe confort fastweeb it x change francisca dimage z5 nera casse da studio stampante fotografica professionale hp carlo cracco libri un uomo da buttare calcio ps2 videogiochi www navy it lightnining sopra e sotto il ponte hifi 5 1 filmati hard selen gratis hard disc iomega 250gb firewire gerico 2004 boogyman coltivazione della marjuana modena wireless racing wheel tenda 3 persone tubo gas i-mate - jam gps nissan micra 1.3 pamela cartoni sun ktv sharik hoge veluwe mercanteinfiera a parma imponente sulla strada jack kerouac libri ambulanze usate garboli villaggio turistici puglia dido video white flag dvd verbatim datalife plus azo fbi protezione testimoni auto noleggio bolzano panchiao wuthering heights last minute rodi cavo usb fujifilm gallerie fotografiche gratuite tettone m ci sarai fracesco renga lora della furia sophia loren palmare gprs microsoft ordu (provincia) gig dalessio cd cover manga com traduzione last thing on my mind tylko czarne oczy teh reason principio speranza amd athlon64 3200 (socket 939) la farfalla come animale le ragazze dei quartieri alti auto eten crono belt begees avvitatore ad aria mazonaki linksys adapter ags (tecnica) dentaria la commissaria inserimento annunci gigabyte k8nsc nforce3 assicurazione varazze luoghi allaperto copione de i cento passi del mariachi pagina erotica sei speciale km0 opel meriva auto km 0 mp3 latin pop pannolini huggies t66 ericsson mappa stradale nudi gratis acer n35 accessori baby pratik occupazione nude cristina aguilera israel kamakawiwo ole mp3 free blan biliardo carnielli tapis roulant paolo meneguzzi testi just the wai yuo are barry white atletica leggera rex combinato a dibujos tridimensionales camper vendesi bagliori di guerra istituto salvemini tim miss motorola offerta auto km 0 sei colpi in canna touareg 3.0 tdi mmc 512mb dual voltage ricevitore gps blutooth freepops fangcheng el organo palmare con telefono e fotocamera televisore multistandard dvd mannoia lettere da amore creed my sacrifice natalia millan valentina uomini e donne lovale sodomia - la visita del vicino eiffel 65 another way sandisk mp3 apple ipod mini (6 gb) www ragazze nigeriane it ritornerai gaggia espresso paola e chiara cantanti nude usb flash mp3 samsung miniket vp ivette sangalo lettore di schede sandisk sai tenere un segreto pioneer deh-4700mp varsavia cose fare viava la pappa negozi di bomboniere campania di silvester stallone korea sex video milano mosca xd olympus 128mb camini e stufe i cavalieri dello zodiaco baby can i hold you tonight panini spa witch hunter robin. vol. 05 www dolce e gabbana affittacamere lucca lacafetera larva gatitas annunci ragazze vogliose fujifilm finepix f610 lupen fisarmonica il teatro di john keats celeron d 336 loewe spheros 37 hd www finanze mitsubishi condizionatori trial cavo surround qv-r52 casio confort trio firenze zurigo biglietti aerei centri urbani de bary, heinrich anton banconota italiane nike solas air www caravanbacci it foto annunci singole donne amanti anal amapola com lettore cd radio calcolo indennita occupazione hyundai 201p hard disk portatile lettore memory card scuola per estetista f410 ever 2005 q cd britney spears le bouton d or panasonic lumix 30 virgilio mail ghost norton == 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