6.0.0-git
2024-04-26
Last Modified 2005-08-18 by Jan Schneider

This is a brief synopsis of the steps required to add arbitrary per-application permissions to the Horde permission system.

In this example we'll add the permission "arbitrary_permission" to module foo.

in foo/lib/api.php:


$_services['perms'] = array(

    'args' => array(),

    'type' => '{urn:horde}stringArray'

);

and


function _foo_perms()

{

    static $perms = array();

    if (!empty($perms)) {

        return $perms;

    }

   $perms['tree']['foo']['arbitrary_permission'] = false;

   $perms['title']['foo:arbitrary_permission'] = _("Textual description");

   $perms['type']['foo:arbitrary_permission'] = 'boolean';

   $perms['param']['foo:arbitrary_permission'] = array();

   return $perms;

}

Then, once you have created an object that you wish to apply those permissions to,


global $perms;

$p = $perms->newPermission('foo:arbitrary_permission');

$perms->addPermission($p);

After that, you should see the permission that you created on the permissions administration page.