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.

') . t('

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.

'); } } /** * Implementation of hook_perm(). */ function project_issue_extend_perm() { return array( PROJECT_ISSUE_PERM_SETTER, PROJECT_ISSUE_PERM_GETTER, ); } /** * Implementation of hook_form_alter(). * * Add all users to select for assigning issues. */ 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' */)) && user_access(PROJECT_ISSUE_PERM_SETTER)) { $options = array(0 => t('Unassigned')); $sq = "SELECT DISTINCT u.uid, u.name " . "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 u.status = 1 AND p.perm LIKE '%%%s%%' " . "ORDER BY u.name"; $sq = db_rewrite_sql($sq, 'u', 'uid'); $result = db_query($sq, PROJECT_ISSUE_PERM_GETTER); while ($user = db_fetch_object($result)) { $options[$user->uid] = $user->name; } switch ($form_id) { case 'project_issue_node_form': if ($form['issue_info']['assigned']) { $form['issue_info']['assigned']['#options'] = $options; } break; case 'comment_form': // project_comment_form if ($form['original_issue']['project_info']['assigned']) { $form['original_issue']['project_info']['assigned']['#options'] = $options; } break; } } }