X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=classes%2Fplmodule.php;h=4cd113c1900680c1a60fc1fd22933fe128ed1cac;hb=fc10da9a3e2cf019a4c6722288e2f063e3ec1728;hp=4219036041e96c1343d9eaf451a223665797bfb9;hpb=5ddeb07cc787dd1dc3630a31f1528f5cc7c4d9b9;p=platal.git diff --git a/classes/plmodule.php b/classes/plmodule.php index 4219036..4cd113c 100644 --- a/classes/plmodule.php +++ b/classes/plmodule.php @@ -19,11 +19,25 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ***************************************************************************/ -class PLModule +abstract class PLModule { - function handlers() { die("implement me"); } + abstract function handlers(); - function make_hook($fun, $auth, $perms = '', $type = DO_AUTH) + /** Register a hook + * @param fun name of the handler (the exact name will be handler_$fun) + * @param auth authentification level of needed to run this handler + * @param perms permission required to run this handler + * @param type additionnal flags + * + * Perms syntax is the following: + * perms = rights(,rights)* + * rights = right(:right)* + * right is an atomic right permission (like 'admin', 'user', 'groupadmin', 'groupmember'...) + * + * If type is set to NO_AUTH, the system will return 403 instead of asking auth data + * this is useful for Ajax handlers + */ + public function make_hook($fun, $auth, $perms = 'user', $type = DO_AUTH) { return array('hook' => array($this, 'handler_'.$fun), 'auth' => $auth, @@ -43,4 +57,5 @@ class PLModule } } +// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: ?>