Local permissions for photo album

Discussion forum for MOD Writers regarding MOD Development.
Locked
MaracujaJoe2
Registered User
Posts: 3
Joined: Wed Jan 07, 2009 8:57 pm

Local permissions for photo album

Post by MaracujaJoe2 » Wed Jan 07, 2009 9:00 pm

Hello,

i have some problems with the auth module.
I want to create a photo album mod, with local permissions for each categorie.
Permissions->Album based permissions:
Chosen categorie “Test”:

Can edit?
Can delete?
Can upload?

So that I can ask for a local permission:

if (!$auth->acl_get('album_edit', 5))
{
trigger_error('NOT_AUTHORISED');
}

5 = cat_id

Is something like that possible?

Greetz Yuri :)

User avatar
A_Jelly_Doughnut
Former Team Member
Posts: 34457
Joined: Sat Jan 18, 2003 1:26 am
Location: Where the Rivers Run
Contact:

Re: Local permissions for photo album

Post by A_Jelly_Doughnut » Wed Jan 07, 2009 9:23 pm

Using the auth system for anything other than a forum ID is not easily possible.
A Donut's Blog
"Bach's Prelude (Cello Suite No. 1) is driving Indiana country roads in Autumn" - Ann Kish

MaracujaJoe2
Registered User
Posts: 3
Joined: Wed Jan 07, 2009 8:57 pm

Re: Local permissions for photo album

Post by MaracujaJoe2 » Wed Jan 07, 2009 10:11 pm

Ok, im ready to handle this :-D
Hm, hoped there would be an easyier way :-(

So another question: Do you think an own table auth_album(group_id, cat_id, level) will be faster than a solution with the existing auth system?

Or do you have another idea how to handle the problem with the existing auth system?
Maybe with the normal globla permissions?

I think i probably think to difficult ...

What about that:

if (!$auth->acl_get('albumcat_1'))
if (!$auth->acl_get('u_albumcat_...'))
if (!$auth->acl_get('u_albumcat_12'))
{
trigger_error('NOT_AUTHORISED');
}

Im dont know so much about the performance ... will that make the system very slow?

Yuri

User avatar
A_Jelly_Doughnut
Former Team Member
Posts: 34457
Joined: Sat Jan 18, 2003 1:26 am
Location: Where the Rivers Run
Contact:

Re: Local permissions for photo album

Post by A_Jelly_Doughnut » Thu Jan 08, 2009 12:30 am

If you're looking for an example, the only one I know of is poyntesm's phpBB garage. He significantly overhauls the auth class to make this work IIRC. http://www.phpbb.com/community/viewtopi ... 453&hilit=
A Donut's Blog
"Bach's Prelude (Cello Suite No. 1) is driving Indiana country roads in Autumn" - Ann Kish

User avatar
poyntesm
Registered User
Posts: 1671
Joined: Tue Jan 18, 2005 11:19 am
Location: Dublin, Ireland
Contact:

Re: Local permissions for photo album

Post by poyntesm » Thu Jan 08, 2009 12:21 pm

Actaully phpBB Garage does not use any local permissions other than the standard. However the permissions system is one of my favourite parts to phpBB so I do understand 100% what you are interested in do and have achieved it myself.

My time of late has been pretty limited, BUT last year I did write a new auth.php and all associated files to allow mutliple local auth options.

Basically any page where you want to query non forum local options you use the following which the MOD adds... new properties to the auth class for local options.

Code: Select all

$auth->local_option = 'folder_id';
$auth->local_option_name = 'folder_name';
$auth->local_option_table = DS_FOLDERS_TABLE;
$auth->acl($user->data); 
So for performance..as long as the user stays on a page with different local options the users permission cache has it for that different option. Once they switch back to a standard phpBB page the normal local forums have to be rebuilt. This has proved to be a reasonable approach but I did have plans to change the system further so that each time a new local option is encountered its cached without removing the existing local cache.

The way the MOD is written allows as many local options to be used as you want. You need to create some ACP pages to handle the new local option as well. So its not for the faint hearted or those really new to MODing

Roles are tricky though as the roles system was not written with mutiple local options in mind. I was still working on that side.

So if you are interested to view the code I can arrange that. I am not starting a MOD in development topic though as I do not have time to support people with this. You do have to have a reasonably deep understanding of the permissions system. If you are game let me know.

Locked

Return to “[3.0.x] MOD Writers Discussion”