Commit 73d88aa9 authored by Gábor Hojtsy's avatar Gábor Hojtsy
Browse files

#189009 by AjK: edit own poll permission was missing from poll module...

#189009 by AjK: edit own poll permission was missing from poll module (although available for other content types)
parent 2d8529a0
......@@ -54,15 +54,20 @@ function poll_theme() {
* Implementation of hook_perm().
*/
function poll_perm() {
return array('create polls', 'vote on polls', 'cancel own vote', 'inspect all votes');
return array('create polls', 'edit polls', 'edit own poll', 'vote on polls', 'cancel own vote', 'inspect all votes');
}
/**
* Implementation of hook_access().
*/
function poll_access($op, $node, $account) {
if ($op == 'create') {
return user_access('create polls', $account);
global $user;
switch ($op) {
case 'create':
return user_access('create polls', $account);
case 'update':
return user_access('edit polls') || (user_access('edit own poll') && ($node->uid == $user->uid));
}
}
......@@ -177,7 +182,9 @@ function poll_node_info() {
* Implementation of hook_form().
*/
function poll_form(&$node, $form_state) {
$admin = user_access('administer nodes');
global $user;
$admin = user_access('administer nodes') || user_access('edit polls') || (user_access('edit own polls') && $user->uid == $node->nid);
$type = node_get_types('type', $node);
$form = array(
......
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