Using ACLs in an application

This page contains some hints on how to use ACLs in an application.

Values for permissions

The permissions get defined as a bit mask, the single bits representing the following permissions:

permission value
ADMINISTRATION 1
READ 2
WRITE 4
CREATE 8
DELETE 16

To assign multiple permissions, the values have to be combined with a logical OR.

Predefined Permissions

The class 'org.acegisecurity.acl.basic.SimpleAclEntry', contains the following permission constants:

// Base permissions we permit
public static final int NOTHING = 0;
public static final int ADMINISTRATION = (int) Math.pow(2, 0);
public static final int READ = (int) Math.pow(2, 1);
public static final int WRITE = (int) Math.pow(2, 2);
public static final int CREATE = (int) Math.pow(2, 3);
public static final int DELETE = (int) Math.pow(2, 4);
 
// Combinations of base permissions we permit
public static final int READ_WRITE_CREATE_DELETE = READ | WRITE | CREATE | DELETE;
public static final int READ_WRITE_CREATE = READ | WRITE | CREATE;
public static final int READ_WRITE = READ | WRITE;
public static final int READ_WRITE_DELETE = READ | WRITE | DELETE;
Recent changes RSS feed Creative Commons License Donate Driven by DokuWiki