summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2004-11-04 22:31:46 +0000
committerDries Buytaert <dries@buytaert.net>2004-11-04 22:31:46 +0000
commitbb3df8a1a98c4f5aaf6a90bec25d22fac14e7d44 (patch)
treeb272c9df71bea7630cdee2e3ada8b89e753c82d4
parentb3e3f8ae373c47fae44156d86fc481fcb196c17b (diff)
downloadbrdo-bb3df8a1a98c4f5aaf6a90bec25d22fac14e7d44.tar.gz
brdo-bb3df8a1a98c4f5aaf6a90bec25d22fac14e7d44.tar.bz2
- Patch #10632 by Gerhard: the book permissions in today's cvs are not consistent with the rest of Drupal. We have a "maintain books" and a "edit own book pages" permission. All other modules have a "create foo" permission. Thus the existing "maintain books" permission should be renamed to "create book pages" and a new "maintain books" permission should be introduced that allows editors to update book pages they haven't created themselves even without having "administer nodes" permission.
-rw-r--r--modules/book.module9
-rw-r--r--modules/book/book.module9
2 files changed, 8 insertions, 10 deletions
diff --git a/modules/book.module b/modules/book.module
index 08fd6f876..1b6583073 100644
--- a/modules/book.module
+++ b/modules/book.module
@@ -17,7 +17,7 @@ function book_node_name($node) {
* Implementation of hook_perm().
*/
function book_perm() {
- return array('maintain books', 'edit own book pages');
+ return array('create book pages', 'maintain books', 'edit own book pages');
}
/**
@@ -37,7 +37,7 @@ function book_access($op, $node) {
if ($op == 'create') {
// Only registered users can create book pages. Given the nature
// of the book module this is considered to be a good/safe idea.
- return user_access('maintain books');
+ return user_access('create book pages');
}
if ($op == 'update') {
@@ -48,8 +48,7 @@ function book_access($op, $node) {
// revision"-bit is set. That is, only updates that don't overwrite
// the current or pending information are allowed.
- return (user_access('maintain books') && !$node->moderate && $node->revision)
- || ($node->uid == $user->uid && user_access('edit own book pages'));
+ return ((user_access('maintain books') && !$node->moderate && $node->revision) || ($node->uid == $user->uid && user_access('edit own book pages')));
}
}
@@ -81,7 +80,7 @@ function book_menu($may_cache) {
if ($may_cache) {
$items[] = array('path' => 'node/add/book', 'title' => t('book page'),
- 'access' => user_access('maintain books'));
+ 'access' => user_access('create book pages'));
$items[] = array('path' => 'admin/node/book', 'title' => t('books'),
'callback' => 'book_admin',
'access' => user_access('administer nodes'),
diff --git a/modules/book/book.module b/modules/book/book.module
index 08fd6f876..1b6583073 100644
--- a/modules/book/book.module
+++ b/modules/book/book.module
@@ -17,7 +17,7 @@ function book_node_name($node) {
* Implementation of hook_perm().
*/
function book_perm() {
- return array('maintain books', 'edit own book pages');
+ return array('create book pages', 'maintain books', 'edit own book pages');
}
/**
@@ -37,7 +37,7 @@ function book_access($op, $node) {
if ($op == 'create') {
// Only registered users can create book pages. Given the nature
// of the book module this is considered to be a good/safe idea.
- return user_access('maintain books');
+ return user_access('create book pages');
}
if ($op == 'update') {
@@ -48,8 +48,7 @@ function book_access($op, $node) {
// revision"-bit is set. That is, only updates that don't overwrite
// the current or pending information are allowed.
- return (user_access('maintain books') && !$node->moderate && $node->revision)
- || ($node->uid == $user->uid && user_access('edit own book pages'));
+ return ((user_access('maintain books') && !$node->moderate && $node->revision) || ($node->uid == $user->uid && user_access('edit own book pages')));
}
}
@@ -81,7 +80,7 @@ function book_menu($may_cache) {
if ($may_cache) {
$items[] = array('path' => 'node/add/book', 'title' => t('book page'),
- 'access' => user_access('maintain books'));
+ 'access' => user_access('create book pages'));
$items[] = array('path' => 'admin/node/book', 'title' => t('books'),
'callback' => 'book_admin',
'access' => user_access('administer nodes'),