[cvs] [Wiki] changed: PermHowTo
Wiki Guest
wiki at wiki.horde.org
Mon Jun 20 23:10:18 PDT 2005
guest [212.202.174.167] Mon, 20 Jun 2005 23:10:18 -0700
Modified page: http://wiki.horde.org/PermHowTo
New Revision: 1.3
Change log: added code blocks
@@ -2,15 +2,18 @@
In this example we'll add the permission "arbitrary_permission" to module foo.
in foo/lib/api.php:
+<code type="php">
$_services['perms'] = array(
'args' => array(),
'type' => '{urn:horde}stringArray'
);
+</code>
and
+<code type="php">
function _foo_perms()
{
static $perms = array();
if (!empty($perms)) {
@@ -23,13 +26,16 @@
$perms['param']['foo:arbitrary_permission'] = array();
return $perms;
}
+</code>
Then, once you have created an object that you wish to apply those permissions to,
+<code type="php">
global $perms;
$p = $perms->newPermission('foo:arbitrary_permission');
$perms->addPermission($p);
+</code>
After that, you should see the permission that you created on the permissions administration page.
More information about the cvs
mailing list