Remember Me
forgot your password?

Acl and Phpgacl

ACL

What is an Access Control List:

An Access Control List (ACL) is a system that can be used to control access to specified resources. In this context we are mainly concerned with resources such as Web pages, application classes and sections, for example administrators or members sections of a Web application.
An overview of the ACL structure used in this example can be seen in the diagram below.

ACL Overview

ACL Overview

An Access Control List is comprised of elements that define who can access what on a particular system. For example:

The Resources

The Person or Role

Access

KB Site>Members Pages

KB Site Actors>KB Member

ALLOW


  • This ACL says that the resource “Members Pages” is in a resources category called “KB Site”.



  • The “KB Member” is a “thing” or “actor” that can define a person, or a role played by a person such as a member of a forum. This actor (KB Member) is defined in a “things” category called “KB Site Actors”.



  • The ACL now says that this actor has a particular permission for this resource. In this case our “KB Member” actor is ALLOWed to access this “Members Pages” resource. If we specify the access as “DENY”, the “KB Member” actor would not be allowed access to this resource.


PhpGALC

The PHP Generic Access Control List:

This ACL implementation uses the PHP Generic Access Control List (phpGACL) package. Generic Access Control List was written by Mike Benoit and is available on SourceForge: phpgacl.sourceforge.net
Mike has developers a quite comprehensive administrative Web interface for phpGACL. This interface makes the setup and management of the Access Control List and its components very much easier than it otherwise would be. The package also contains a user manual in several formats.
Installing the PHP Generic Access Control List:
The PHP Generic Access Control List (phpGACL) can be grouped into two basic categories of usage:
The first part is the small and fast gacl client class that simply queries the ACL database. This is the class we load as a PlugIn and call within our restricted methods.
The second part is the administration classes and Web interface that allow the setup and maintenance of the ACL system and its database

Load the example ACL SQL data (MySQL):

Some ACL data can be found in the Ext/sql directory for use with the example. If using MySQL you can load the data at the command line, something like:
$ ./bin/mysql -u userid -puserpword < /tmp/kb_acl.sql
The SQL dump file will create a database named “gacl_mvc”. Be careful not to overwrite any existing database you have with the same name. There is also an XML file dump of the ACL database that may be useful to users of other DBMS systems.
Browse to the “Main.php” file in the phpGACL example directory, with the action path as shown:
www.myhost.com/phpGACL/Main.php?do=testACL
Select a user role in the form and observe the access levels reported for this user role.

Installing the Access Control List Database and Interface:

The process of setting up and administrating the ACL (phpGACL) can be a little tricky at first. The steps I have taken to install and setup the ACL system are as follows:
Note: See the install section in the phpGACL user manual for more details.
Note for MySQL users: I could not get the phpGACL Web interface to operate successfully using the MySQL DBMS. Mike uses the “sequence list” feature of many DBMS’s to obtain table ID’s. As far as I know MySQL does not yet support sequence lists. I have modified the file “gacl_api.class.php” to work around this issue. The modified file is included with the phpGACL PlugIn example, in the Ext directory.

Download the phpGACL archive from the authors SourceForge site:

Open the /admin/gacl_admin.inc.php file and edit the $gacl_options array to specify the Database Management System (DBMS) and host, username and password and the name we want to use for the ACL database. For example:
‘db_type’ => ‘mysql’
‘db_host’ => ‘localhost’
‘db_user’ => ‘myuser’
‘db_password’ => ‘mypword’
‘db_name’ => ‘gacl’
Logon to your DBMS and create the ACL database. Something like:
>mysql u myuser pmypword
mysql>Create Database gacl_mvc;
Browse to the phpGACL install directory and open “setup.php”. For example: http://www.myhost.com/libs/phpgacl/setup.php . This should install the necessary ACL tables in the database we specified above.
Add a Smarty compile directory to the phpGACL directory as follows: phpgacl/admin/smarty/templates_c. Make this compile directory writable by the Web server.
Secure the phpGACL directory with an .htaccess file (or other suitable means) to control who can access your phpGACL directory.

Browse to the phpGACL administrative page:

http://www.myhost.com/libs/phpgacl/admin/acl_admin.php. This will display the ACL interface where you can setup and maintain your Access Control Lists.
If using MySQL and the administrative page does not work as expected see the note for MySQL users above.

Administrating the Access Control List:

Please refer to the phpGACL user manual for a detailed discussion on Access Control List theory.
This figure shows the ACL administrator main page. This is where we can specify Access Control Object (ACO) resources we want to control, and the Access Request Object (ARO) “actors” associated with the ACO, along with the Access status (Allow, Deny). There is also a field at the bottom of the form where a description of this item can be entered. The selections on this form would become an entry in the phpGACL ACL list.

Administrating the Access Control List

Administrating the Access Control List

Another point to note is that the default assess policy for the ACL lists is DENY.
The PHP Generic Access Control List (phpGACL) uses several primary elements: Access Control Objects (ACO), Access Request Objects (ARO), The Access Control List (ACL) and Access Request Object Groups.
Access Control Objects (ACO)
These are the resources that we want to control access to, like Web pages, class methods or sections etc.
All ACO items must be identified with an ACO section. In this example we define a “KB Site” section as the logical container to hold various controlled resources for this site.
We must add a new resource section (ACO) before we can add any actual resource objects. To add or edit a resource section (ACO), use the “Edit” link on the top left of the ACL Administrator Main Page. (See figure 2).
Now we can add actual Access Control Objects (ACOs) using the “Edit” link on the ACL Administrator Main Page, under the “Access Control Objects” heading. Be sure to select a “Sections” item first. For example “KB Site”.
This figure shows the “KB Site” section with three ACO resources: “Admin Pages”, “Members Pages” and “Public Pages”.

ACO resources

ACO resources

Access Request Objects (ARO)
These are the “things” or actors that we can allocate permissions to allow access to particular ACO resources. An ARO could be a person, or a role played by a person such as a member of a forum, or represent some other item such as a server.
Again we must add an ARO section before we can add any ARO “actors”. To add or edit an ARO section, use the “Edit” link on the mid left of the ACL Administrator Main Page. (See figure 2).
Now we can add actual Access Resource Objects (ARO) using the “Edit” link on the ACL Administrator Main Page, just below the “Access Request Objects” heading. Be sure to select a “Sections” item first. For example “KB Site Actors”.
This figure shows the “KB Site Actors” section with four ARO resources: “KB Admin”, KB Members” and “KB Public” and a sudo admin “KB Supervisor”.

ARO resources

ARO resources

The Access Control List (ACL)
As described above, an Access Control List is comprised of elements that define who can access what on a particular system. For example:

The Resources

The Person or Role

Access

KB Site>Members Pages

KB Site Actors>KB Member

ALLOW

This ACL says that this actor has a particular permission (ALLOW) for this resource. In this case our “KB Member” actor is ALLOWed to access this “Members Pages” resource. If we specify the access as DENY, the “KB Member” actor would not be allowed access to this resource.
To create an ACL entry we use the ACL Administrator form (See figure 2). Select the appropriate resources (ACOs), actors (AROs), set the access permission (ALLOW or DENY) and add a descriptive note (bottom of the admin form). When we hit the “Submit” form button an ACL list entry is created. To view the ACL list use the “ACL List” link at the top of the ACL Administrator form. The ACL list for our example site is shown in figure 5:

ACL list

ACL list

Access Request Object Groups
The phpGACL also contains the ability to use Groups to add additional flexibility to the Access Control Lists system.
Using the ACL Groups function we can add users or other actors (AROs) to an ARO Group. This group can then be granted permissions on a particular resource (ACO).
Initially we must create a group section. The Groups form is accessed via the “ACL List -> ARO Group Admin” link. The ARO Group Administrator form should look something like figure 6:

Access Request Object Groups

Access Request Object Groups

From this form we can hit the “Add” button to add groups and child groups. For this example I have created a KB Group item as the parent group for this site, and several sub-groups: KB Admins Group, KB Members Group and KB World Group.
Next we have to assign our site users or actors (AROs) to the groups. So from the ARO Group Administrator page we hit the “Assign ARO” link for the appropriate group. Perhaps we wanted to add a sudo administrator actor to the administrators group, so we could temporarily promote someone to the administrator role. So we hit the “Assign ARO” link in the “KB Admins Group” row on the Group Administrator page, and a form should come up that will allow us to manage the ARO actors we wish to assign to the “KB Admins Group”. Figure 7 shows the KB Admins Group form with two ARO actors assigned to this group.

Assign ARO

Assign ARO

We can see that the KB Supervisor ARO actor is included in the KB Admins Group. I’ve also added the KB Admin ARO actor to the KB Admins Group for completeness, although this entry is probably not necessary. The other ARO actors can be assigned to relevant groups in a similar manner.
When all the group entries are complete, we can return to the phpGACL Administrator page (see figure 2). From there we can add one or more groups to an Access Control List entry. For example I have added the KB Admins Group to the KB Admin ARO entry, so any user with KB Supervisor status will have the same access rights as the administrator on the system.
Reviewing and Testing the ACL
To review the Access Control List entries hit the “ACL List” link at the top of the ACL Administrator form (see figure 2). We can now see the groups that have been added to each ACL.
When our Access Control List is complete we can check the entries using the “ACL Test” page link. For the example ACL data, the ACL test page should look something like figure 8 below:

ACL List

ACL List

TuVinhSoft .,JSC

TuVinhSoft - Software Development Company from Vietnam provides Offshore software development, Software Outsourcing, Staff augmentation, Application Software Development, Web Design and Development, Business Process Outsourcing, Search Engine Optimization to USA, UK, Japan etc.

Rate this Article: 5 / 5 stars - 1 vote(s)
Print Email Re-Publish

Add new Comment



Captcha

  • Latest Programming Articles
  • More from TuVinhSoft .,JSC

How to Solve the Registry Errors

By: janson | 27/11/2009
The Registry of Windows is the most important for the working of the computer system due to it stores valuable data which can cause serious loss in performance of the system. The registry files of Windows are set to save the configuration settings of Windows and they are spread around on the hard disk. To solve the errors of them was absolute a Herculean task.

Gravity Jack Software Studio is a new venture that is pushing the envelope in the mobile software development arena

By: Adam Chronister | 26/11/2009
Gravity Jack opened offices this month in Liberty Lake and is currently filing patents regarding a tightly-kept secret project that is expected to revolutionize the way people interact with mobile computing platforms such as Apple’s iPhone and Google’s Android.

PHP and Open Source, Keys to build complex but Affordable websites

By: Mahendra Sharma | 26/11/2009
Gone are the days when high tech programmers and high profile companies were required to be engaged to develop a complex system on web. Open Source and especially PHP developers have changed the scenario. Every other day you can find new software available as open source developed by PHP programmers. Essential thing is such software is available for free or at nominal cost.

Java Application development India

By: Rightway Solution | 25/11/2009
Java is most suitable for creating Enterprise Applications for its flexibility and control. JAVA is used to create wide range of application with an extensive functionality.

Understanding the Typical Structure of Software Testing Process

By: yogindernath | 25/11/2009
Understanding the Typical Structure of Software Testing Process

CRM Customisation

By: Manny de Sousa | 24/11/2009
Next Generation CRM platforms need to offer full customisation. With the number of flexible design tools and components for .net and other development platforms there are no excuses for CRM providers not to offer truly simple customisation tools that can be used by non IT minded individuals

Computer technology - How to make your computer work faster?

By: janson | 24/11/2009
Computer slows down over time due to every day use. It makes simple tasks start taking minutes or hours to finish. In order to make the computer work effectively and quickly, it is necessary for the computer users to do something to improve the performance of the computer.

VB Calculator

By: pons_saravanan | 24/11/2009
This article is targeted for the learners. I am trying to explain the use of Control Arrays with the help of Calculator Sample.

LAMP Application Development Vietnam

By: TuVinhSoft .,JSC | 22/10/2009 | Outsourcing
TuVinhSoft provides offshore development and Outsourcing services based on several years of experience in executing projects based on Linux, Apache, MySQL and PHP (LAMP) technologies.

5 Reasons to Outsource Software Development Projects

By: TuVinhSoft .,JSC | 18/10/2009 | Outsourcing
To satisfy the customers most of the providers are occupied in developing new programs, providing add-ons, and new versions. In these days of globalization many firms are looking for the software development outsourcing provider.

Web 2.0 Development in Vietnam

By: TuVinhSoft .,JSC | 15/07/2009 | Web Design
Web 2.0 standards are being accepted across the globe to facilitate creativity, information sharing, collaboration among web users in the World Wide Web technology and web design. Web 2.0 has lead to the concept of new generation for web oriented communities like social-networking sites, Wikis, Blogs, and folksonomies.

Offshore Outsourcing Development in Vietnam

By: TuVinhSoft .,JSC | 03/07/2009 | Outsourcing
If you share the world opinion that Vietnam is the outsourcing hot spot we will prove it to you. Ours becomes an extension to your office via the internet and E-mail. Your offshore project world seem to be happening right outside of your cabin.

The best software development center and software outsourcing in Vietnam

By: TuVinhSoft .,JSC | 30/05/2009 | Outsourcing
An offshore development center(ODC) offers clients enormous benefits. ODCs consist of a dedicated pool of software professionals who form a virtual extension of the client's team. ODC (http://www.tuvinh.com ) offer the best of both worlds - the benefits of one's own team without the difficulties of managing it. In addition, offshore development centers enables clients to scale up their teams, in terms of numbers or skill sets.

Acl and Phpgacl

By: TuVinhSoft .,JSC | 02/02/2009 | Programming
What is an Access Control List: An Access Control List (ACL) is a system that can be used to control access to specified resources. In this context we are mainly concerned with resources such as Web pages, application classes and sections, for example administrators or members sections of a Web application.

Mvc Design Pattern

By: TuVinhSoft .,JSC | 14/11/2008 | Programming
Model-view-controller (MVC) is an architectural pattern used in software engineering. In complex computer applications that present a large amount of data to the user, a developer often wishes to separate data (model) and user interface (View) concerns, so that changes to the user interface will not affect data handling, and that the data can be reorganized without changing the user interface.

Submit Your Articles Free: Signup
Article Categories




Use of this web site constitutes acceptance of the Terms Of Use and Privacy Policy | User published content is licensed under a Creative Commons License.
Copyright © 2005-2008 Free Articles by ArticlesBase.com, All rights reserved. (0.08, 1, w2)