Active
Project:
Case Tracker
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
24 May 2010 at 15:33 UTC
Updated:
25 Jul 2011 at 12:43 UTC
Please is it possible to have "assign status" permissions, similar to what we currently have for "assign cases".
This way, specific roles can ge granted authority to change state of status via admin/user/permissions.
Comments
Comment #1
zeezhao commentedAlternatively, please does anyone know the best way to hide "Status" from all users except those with "assign cases" permissions?
Comment #2
Grayside commentedStep 1: Implement hook_form_comment_form_alter
Step 2: Insert $form['casetracker']['case_status_id']['#access'] = user_access('assign cases');
Note: This may result in wiping out your status to default with each comment that does not have access to set status. If so, that will take more patchery.
Comment #3
zeezhao commentedThanks for the suggestion.
What I actually did temporaily was to hide the status field using the formfilter module, so that its not visible when in edit mode.
And then have a button driven by triggered rules to change the status as required. For the buttons, I am using button_field module. Access is granted to button via permissions/role.
Comment #4
zeezhao commentedThanks for the suggestion. I tried it out but could not get it to work...
Is there a way of setting precedece for execution? Guessing it may have something to do with that. I know it gets into the hook as I added a drupal_set_message() to confirm this. I also tried adding this to the hook_form_comment_form_alter:
$form['casetracker']['case_status_id']['#access']= FALSE;
By the way, what would it take to add it to the form creation in casetracker.module so that it is used by deafult? What are the other major changes required i.e.
Comment #5
Grayside commentedThere are some strange precedence issues with the hook_form_alter() stuff. Try this instead:
What happens is that all the hook_form_FORM_ID_alter() functions are called before hook_form_alter(), and that's apparently where casetracker is making the changes. Casetracker stuff does not yet exist at the time you've been trying to adjust it.
I am against adding this into CT itself. It's non-standard behavior for a specific use-case. For example, anyone wanting to avoid the complications of anonymous users flooding a casetracker thread would have to make a modification to return comment behavior to normal.
This seems like a case for general comment customization documentation to which CT could refer. Or a thorough write-up at the end of this issue.
Comment #6
zeezhao commentedThanks for your help. Got it to work using hook_form_alter().
I agree it should not be in casetracker.module. But in future, may be an extra option for configuration.
Fyi - my own use case is an internal system with workflow-type functionality. So all users already have IDs on AD. So using ldap for authentication. Also specific users in groups have permissions to open/close/reject a case etc. Hence the reason to limit who can change the Status. Also some of the casetracker-based nodes have extra fields which are hidden or shown based on role etc.
Comment #7
Grayside commentedYou know, I got my wires crossed on which issue this is. I can definitely see this as an option.
Comment #8
ultimikeI'm working on a sub-module for casetracker that will allow for role-protected state values. I've posted details about what I'm doing here: https://community.openatrium.com/issues/node/2123 (although in hindsight, I probably should have just posted it here...)
-mike
Comment #9
Grayside commented@ultimike Yeah, that sounds like a separate issue for this queue.
Comment #10
zeezhao commentedHi. Please confirm if the sub-module is now available. Thanks
Comment #11
ultimike@zeezhao - nope, sorry. The client changed their mind and I didn't end up creating this module.
Thanks,
-mike