[cvs] [Wiki] changed: PermHowTo
Wiki Guest
wiki at wiki.horde.org
Thu May 26 13:16:38 PDT 2005
guest [128.196.135.7] Thu, 26 May 2005 13:16:38 -0700
Modified page: http://wiki.horde.org/display.php?page=PermHowTo
New Revision: 1.1
@@ -1 +1,35 @@
+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.
More information about the cvs
mailing list