Configuring ACL

Walrus as an integrated ACL heritage tree, you have to define it in the config/acls/acl.yml

All configuration YAML files in walrus are parsed to PHP array, you can create all the files you want in the correct configuration directory

  partner: 'advertise'
      student: 'learn'

This exemple give:

  • The student can only learn
  • The teacher get all student rights (learning) and can teach
  • The partner can only advertise
  • The administrator get all student, teacher and partner right, administrator can also administrate

The ACL tree is used in the routing and skeleton by comparing the $_SESSION['acl'] variable. You need to fill this variable and make it available.

Using ACL

To help you in your application with ACL, the WalrusACL class give you two useful methods which return boolean.

    // Check if a user with the role "teacher" can access something who require a student role
    WalrusACL::hasRight('teacher', 'student');

    // Check if a user with the role "administrator" can do the task advertise
    WalrusACL::hasRight('administrator', 'advertise');