diff options
author | Dries Buytaert <dries@buytaert.net> | 2001-06-20 20:00:40 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2001-06-20 20:00:40 +0000 |
commit | 72065fb8351b54eee5f1928c18e06ad81aa9b502 (patch) | |
tree | 59052fb790134eed81b52b69150a1e231bd44083 /modules/moderate.module | |
parent | 7752dc4c7c4cffda07152d8ee89bce05f16a5d6c (diff) | |
download | brdo-72065fb8351b54eee5f1928c18e06ad81aa9b502.tar.gz brdo-72065fb8351b54eee5f1928c18e06ad81aa9b502.tar.bz2 |
- Added a brand-new access.module which allows you to manage 'roles'
(groups) and 'permissions' ... (inspired by Zope's system).
+ Once installed, click the help-link for more information.
+ See updates/2.00-to-x.xx.sql for the SQL updates.
- Modified loads of code to use our new access.module. The system
still has to mature though: new permissions have to be added and
existing permissions need stream-lining. Awaiting suggestions.
- As a direct result of the new access system, I had to rewrite the
way the top-level links in admin.php are rendered and displayed,
and xhtml-ified admin.php while I was at it.
TODO
- Home-brewed modules need updating, home-brewed themes not.
(Examples: file.module, trip_link.module)
- As soon we *finished* the refactoring of the user system (KJ has
been working on this refactoring already) we should consider to
embed this role and permission code into account.module ...
Diffstat (limited to 'modules/moderate.module')
-rw-r--r-- | modules/moderate.module | 70 |
1 files changed, 40 insertions, 30 deletions
diff --git a/modules/moderate.module b/modules/moderate.module index c3db8abab..a75402c3a 100644 --- a/modules/moderate.module +++ b/modules/moderate.module @@ -1,5 +1,9 @@ <?php +function moderate_perm() { + return array("access moderation pages"); +} + function moderate_comment_access($cid) { global $user; return db_fetch_object(db_query("SELECT n.moderate FROM comments c LEFT JOIN node n ON c.lid = n.nid WHERE c.cid = '". check_input($cid) ."' AND n.moderate LIKE '%$user->userid%'")); @@ -37,7 +41,7 @@ function moderate_node($edit, $name) { return node_invoke($edit, $name); } else { - return status(t("access denied")); + return status(message_access()); } } @@ -54,7 +58,7 @@ function moderate_comment_edit($id) { return comment_edit($id); } else { - return "access denied"; + return status(message_access()); } } @@ -63,41 +67,47 @@ function moderate_comment_save($id, $edit) { return comment_save($id, $edit); } else { - return "access denied"; + return status(message_access()); } } function moderate_admin() { - global $op, $id, $edit, $type; - - switch ($type) { - case "comment": - switch ($op) { - case "edit": - print moderate_comment_edit($id); - break; - case t("Submit"): - print status(moderate_comment_save($id, $edit)); - // fall through: - default: - print moderate_overview(); + global $user, $op, $id, $edit, $type; + + if (user_access($user, "access moderation pages")) { + + switch ($type) { + case "comment": + switch ($op) { + case "edit": + print moderate_comment_edit($id); + break; + case t("Submit"): + print status(moderate_comment_save($id, $edit)); + // fall through: + default: + print moderate_overview(); + } + break; + default: + switch ($op) { + case "edit": + print moderate_node_edit(node_get_array(array("nid" => $id))); + break; + case t("Preview"): + print moderate_node_edit($edit); + break; + case t("Submit"): + print status(moderate_node_save($edit)); + // fall through: + default: + print moderate_overview(); } - break; - default: - switch ($op) { - case "edit": - print moderate_node_edit(node_get_array(array("nid" => $id))); - break; - case t("Preview"): - print moderate_node_edit($edit); - break; - case t("Submit"): - print status(moderate_node_save($edit)); - // fall through: - default: - print moderate_overview(); } } + else { + print message_access(); + } } ?> |