diff options
author | Dries Buytaert <dries@buytaert.net> | 2004-08-21 15:37:01 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2004-08-21 15:37:01 +0000 |
commit | 6b116794d9b573705dadb429567d01817a817f63 (patch) | |
tree | c0a7040fee36e016a606400a03427f445e21b34b | |
parent | 03fa966c1f6de932d85ad77f91a288698620f031 (diff) | |
download | brdo-6b116794d9b573705dadb429567d01817a817f63.tar.gz brdo-6b116794d9b573705dadb429567d01817a817f63.tar.bz2 |
- Patch #10084: added 'edit own book page' permission: this makes the book
module consistent with the other node modules.
-rw-r--r-- | modules/book.module | 7 | ||||
-rw-r--r-- | modules/book/book.module | 7 |
2 files changed, 8 insertions, 6 deletions
diff --git a/modules/book.module b/modules/book.module index 1a30c2929..ebf710e89 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'); + return array('maintain books', 'edit own book pages'); } /** @@ -31,7 +31,7 @@ function book_access($op, $node) { // are still waiting for approval or not. We might not always want // to display pages that are waiting for approval, but we take care // of that problem in the book_content() function. - return $node->status; + return ($node->status ? $node->status : ($node->uid == $user->uid && user_access('edit own book pages'))); } if ($op == 'create') { @@ -48,7 +48,8 @@ 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; + return (user_access('maintain books') && !$node->moderate && $node->revision) + || ($node->uid == $user->uid && user_access('edit own book pages')); } } diff --git a/modules/book/book.module b/modules/book/book.module index 1a30c2929..ebf710e89 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'); + return array('maintain books', 'edit own book pages'); } /** @@ -31,7 +31,7 @@ function book_access($op, $node) { // are still waiting for approval or not. We might not always want // to display pages that are waiting for approval, but we take care // of that problem in the book_content() function. - return $node->status; + return ($node->status ? $node->status : ($node->uid == $user->uid && user_access('edit own book pages'))); } if ($op == 'create') { @@ -48,7 +48,8 @@ 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; + return (user_access('maintain books') && !$node->moderate && $node->revision) + || ($node->uid == $user->uid && user_access('edit own book pages')); } } |