Commit 7f296f35 authored by jcnventura's avatar jcnventura

Fix #468342: Add mail and PDF-specific access permissions

parent 31b24d6c
......@@ -24,6 +24,18 @@ define('PRINT_MAIL_TEASER_DEFAULT_DEFAULT', 1);
define('PRINT_MAIL_TEASER_CHOICE_DEFAULT', 1);
define('PRINT_MAIL_JOB_QUEUE_DEFAULT', 0);
/**
* Implementation of hook_perm().
*/
function print_mail_perm() {
return array(
'access send to friend' => array(
'title' => t('Access the Send To Friend functionality'),
'description' => t('Provides the ability to send pages to a friend and the links to them in the original pages.'),
),
);
}
/**
* Implementation of hook_theme().
*/
......@@ -48,7 +60,7 @@ function print_mail_menu() {
'title' => 'Send page by e-mail',
'page callback' => 'drupal_get_form',
'page arguments' => array('print_mail_form'),
'access arguments' => array('access print'),
'access arguments' => array('access send to friend'),
'type' => MENU_CALLBACK,
);
$items['admin/settings/print/email'] = array(
......@@ -412,7 +424,7 @@ function print_mail_insert_link($path = NULL, $node = NULL) {
* PRINT_ALLOW_BOOK_LINK if a link is allowed in a book node
*/
function print_mail_link_allowed($args) {
if (!empty($args['teaser']) || !user_access('access print')) {
if (!empty($args['teaser']) || !user_access('access send to friend')) {
// If showing only the teaser or the user is not allowed or link is disabled
return FALSE;
}
......
......@@ -31,6 +31,18 @@ define('PRINT_PDF_WKHTMLTOPDF_OPTIONS', "--footer-font-size 7 --footer-right '[p
define('PRINT_PDF_XVFB_OPTIONS', '');
// define('PRINT_PDF_XVFB_OPTIONS', ' -fp /usr/share/fonts/X11/misc/,/usr/share/fonts/X11/Type1/,/usr/share/fonts/X11/75dpi/,/usr/share/fonts/X11/100dpi/');
/**
* Implementation of hook_perm().
*/
function print_pdf_perm() {
return array(
'access PDF version' => array(
'title' => t('Access the PDF version'),
'description' => t('View the PDF versions and the links to them in the original pages.'),
),
);
}
/**
* Implementation of hook_theme().
*/
......@@ -69,7 +81,7 @@ function print_pdf_menu() {
$items[PRINTPDF_PATH] = array(
'title' => 'Printer-friendly PDF',
'page callback' => 'print_pdf_controller',
'access arguments' => array('access print'),
'access arguments' => array('access PDF version'),
'type' => MENU_CALLBACK,
);
$items['admin/settings/print/pdf'] = array(
......@@ -447,7 +459,7 @@ function print_pdf_insert_link($path = NULL, $node = NULL) {
*/
function print_pdf_link_allowed($args) {
$print_pdf_pdf_tool = variable_get('print_pdf_pdf_tool', PRINT_PDF_PDF_TOOL_DEFAULT);
if (!empty($args['teaser']) || !user_access('access print') || (empty($print_pdf_pdf_tool))) {
if (!empty($args['teaser']) || !user_access('access PDF version') || (empty($print_pdf_pdf_tool))) {
// If showing only the teaser or the user is not allowed or link is disabled
return FALSE;
}
......
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