ACL in RC3 for own component(s)
Posted: Tue Dec 18, 2007 3:07 pm
Ahoy,
I am in the process of developping a series of components that all work together for one specific company,
so no complete publishing here.
I just want to add my two cents to the community that helps me so much in these forums.
First i created a component that supplies a form, in which the administrator can choose a user in a dropdown list,
and then a whole bunch of checkboxes to indicate the different acl levels for my components.
(one checkbox for 'add', one for 'edit', one for 'delete', and so on for every component)
The results are stored in a separate table in the joomla database.
Then I created a separate plugin that checks the id of a given user to the mentioned table,
and returns an acl list.
In the default form that generates a list of documents in my components I added a line at the top;
$aclresults = $mainframe->triggerEvent( 'onaclcheck');
which triggers the plugin to return the acllist into an array in that form.
With that array the users' acl for the documents in the components' documentlist can be calculated,
and if applicable, it shows an 'edit' link in front of the document(s), an 'Add'button at the top, etc.
The whole system still uses the security that is build into the great framework,
but allows me to give permissions the way I want it to my components.
Downside to this approach is the databse call everytime a list of documents is asked for,
so I'm trying to get this into $mainframe variables, but for now this works.
By working with separate components and plugins that work together like this, it's easy
to maintain and expand the whole project while going live in the meantime.
Hope this helps someone on the way to develop something similar.
Bert
I am in the process of developping a series of components that all work together for one specific company,
so no complete publishing here.
I just want to add my two cents to the community that helps me so much in these forums.
First i created a component that supplies a form, in which the administrator can choose a user in a dropdown list,
and then a whole bunch of checkboxes to indicate the different acl levels for my components.
(one checkbox for 'add', one for 'edit', one for 'delete', and so on for every component)
The results are stored in a separate table in the joomla database.
Then I created a separate plugin that checks the id of a given user to the mentioned table,
and returns an acl list.
In the default form that generates a list of documents in my components I added a line at the top;
$aclresults = $mainframe->triggerEvent( 'onaclcheck');
which triggers the plugin to return the acllist into an array in that form.
With that array the users' acl for the documents in the components' documentlist can be calculated,
and if applicable, it shows an 'edit' link in front of the document(s), an 'Add'button at the top, etc.
The whole system still uses the security that is build into the great framework,
but allows me to give permissions the way I want it to my components.
Downside to this approach is the databse call everytime a list of documents is asked for,
so I'm trying to get this into $mainframe variables, but for now this works.
By working with separate components and plugins that work together like this, it's easy
to maintain and expand the whole project while going live in the meantime.
Hope this helps someone on the way to develop something similar.
Bert