Class RoleKey

  • All Implemented Interfaces:
    AccessControlled, Identifiable, Nameable

    public class RoleKey
    extends Key
    implements Nameable
    This class is used to represent a role key. A role key is, as the name suggests, a key that can be given to roles.

    A BASE installation comes with a default set of role keys, one for every type of item. The keys cannot be deleted and no new ones can be created. The id of a role key for an item can be found by calling SystemItems.getRoleKeyId(Item).

    The permission given to a role is applied to all items of the type that the role key is valid for. The following example code will give all users the permission to create samples.

    Role r = Role.getById(dbControl, Role.USER);
    RoleKey rk = RoleKey.getById(dbControl, SystemItems.getRoleKeyId(Item.SAMPLE));
    rk.setPermission(r, Permission.CREATE);
    dbControl.commit();
    
    Version:
    2.0
    Author:
    Nicklas
    Last modified
    $Date: 2015-04-17 14:02:22 +0200 (fr, 17 apr 2015) $