Commit 6b116794 authored by Dries's avatar Dries

- Patch #10084: added 'edit own book page' permission: this makes the book

  module consistent with the other node modules.
parent 03fa966c
......@@ -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'));
}
}
......
......@@ -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'));
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment