|
@@ -1,24 +1,25 @@
|
|
<?php
|
|
<?php
|
|
|
|
+// $Id: project_issue_extend.module,v 1.2 2009-12-03 21:35:05 fgm Exp $
|
|
/**
|
|
/**
|
|
* A small module to assign issues to users
|
|
* A small module to assign issues to users
|
|
* Derived from Nedjo Rogers' module for 4.7
|
|
* Derived from Nedjo Rogers' module for 4.7
|
|
* See http://drupal.org/node/4354 for the discussion
|
|
* See http://drupal.org/node/4354 for the discussion
|
|
*
|
|
*
|
|
- * @version $Id: project_issue_extend.module,v 1.1 2009-12-03 20:55:33 root Exp $
|
|
|
|
* @license GPL 2.0
|
|
* @license GPL 2.0
|
|
*
|
|
*
|
|
*/
|
|
*/
|
|
|
|
|
|
-define(PROJECT_ISSUE_PERM_SETTER, 'assign project issues to others');
|
|
|
|
-define(PROJECT_ISSUE_PERM_GETTER, 'be assigned project issues');
|
|
|
|
|
|
+define('PROJECT_ISSUE_PERM_SETTER', 'assign project issues to others');
|
|
|
|
+define('PROJECT_ISSUE_PERM_GETTER', 'be assigned project issues');
|
|
|
|
|
|
/**
|
|
/**
|
|
* Implementation of hook_help().
|
|
* Implementation of hook_help().
|
|
*/
|
|
*/
|
|
-function project_issue_extend_help($section) {
|
|
|
|
- switch ($section) {
|
|
|
|
- case 'admin/modules#description':
|
|
|
|
- return t('Allow assigning of issues to any member with appropriate permissions.');
|
|
|
|
|
|
+function project_issue_extend_help($path, $arg) {
|
|
|
|
+ switch ($path) {
|
|
|
|
+ case 'admin/help#project_issue_extend':
|
|
|
|
+ return t('<p>This module allows users with the "assign" permission a right to assign issues to users with a "be assigned" permissions. Do not combine with the "assign and be assigned" permission in project_issue.module.</p>')
|
|
|
|
+ . t('<p>Note that unlike usual permissions, these permissions are only checked for an explicit role: granting them to the anonymous account or to the "authenticated user" pseudo-role will not make them assignable.</p>');
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -37,17 +38,17 @@ function project_issue_extend_perm() {
|
|
*
|
|
*
|
|
* Add all users to select for assigning issues.
|
|
* Add all users to select for assigning issues.
|
|
*/
|
|
*/
|
|
-function project_issue_extend_form_alter($form_id, &$form) {
|
|
|
|
|
|
+function project_issue_extend_form_alter(&$form, $form_state, $form_id) {
|
|
if (in_array($form_id, array('project_issue_node_form', 'comment_form', /* was 'project_comment_form' */))
|
|
if (in_array($form_id, array('project_issue_node_form', 'comment_form', /* was 'project_comment_form' */))
|
|
&& user_access(PROJECT_ISSUE_PERM_SETTER)) {
|
|
&& user_access(PROJECT_ISSUE_PERM_SETTER)) {
|
|
$options = array();
|
|
$options = array();
|
|
$result = db_query(
|
|
$result = db_query(
|
|
"SELECT DISTINCT u.uid, u.name "
|
|
"SELECT DISTINCT u.uid, u.name "
|
|
. "FROM {users} u "
|
|
. "FROM {users} u "
|
|
- . "INNER JOIN {users_roles} ur ON u.uid = ur.uid "
|
|
|
|
- . "INNER JOIN {role} r ON ur.rid = r.rid "
|
|
|
|
- . "INNER JOIN {permission} p ON p.rid = r.rid "
|
|
|
|
- . "WHERE p.perm like '%%%s%%' "
|
|
|
|
|
|
+ . " INNER JOIN {users_roles} ur ON u.uid = ur.uid "
|
|
|
|
+ . " INNER JOIN {role} r ON ur.rid = r.rid "
|
|
|
|
+ . " INNER JOIN {permission} p ON p.rid = r.rid "
|
|
|
|
+ . "WHERE p.perm LIKE '%%%s%%' "
|
|
. "ORDER BY u.name",
|
|
. "ORDER BY u.name",
|
|
PROJECT_ISSUE_PERM_GETTER);
|
|
PROJECT_ISSUE_PERM_GETTER);
|
|
while ($user = db_fetch_object($result)) {
|
|
while ($user = db_fetch_object($result)) {
|