#11938 closed enhancement (fixed)
Improve error message from TracAdmin remove when permission doesn't exist
| Reported by: | Ryan J Ollos | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.2 | 
| Component: | admin/console | Version: | |
| Severity: | normal | Keywords: | permission | 
| Cc: | Branch: | ||
| Release Notes: | 
           Improved error message when adding and removing an invalid action with TracAdmin.  | 
      ||
| API Changes: | |||
| Internal Changes: | |||
Description
When attempting to assign an undefined permission a helpful error is echoed.
$ trac-admin ../tracdev permission add anonymous NOT_A_PERM TracError: NOT_A_PERM is not a valid action.
The error message seen when attempting to remove an undefined permission is:
$ trac-admin ../tracdev permission remove anonymous NOT_A_PERM
Error: Cannot remove permission NOT_A_PERM for user anonymous. The user has not been granted the permission.
It would probably be more helpful to check if the permission exists before trying to remove it from a user, in order to echo a more helpful error message in the case that the user makes a typo or a Component isn't loaded.
Attachments (2)
Change History (12)
by , 10 years ago
| Attachment: | 11938-permission-remove-error.v1.patch added | 
|---|
comment:1 by , 10 years ago
comment:2 by , 10 years ago
Unit test would be good. You can add a test in tags/trac-1.0.7/trac/admin/tests/console.py#L307. Expected output goes in tags/trac-1.0.7/trac/admin/tests/console-tests.txt#L96.
comment:3 by , 10 years ago
While I try to add the unit test to the patch, I got one minor issue. The original test suites did not get passed (9 cases failed), I tried to revert all my patches, and set up a clean test environment, and it's still the same.
Later I found that it seems to be related with [13853], which removes BATCH_TICKET_MODIFY by default, so the result file for permission list could not match with the actual output.
I finally manually added back the permission in order to test my patch (but the corresponding change is not included in the patch file).
comment:4 by , 10 years ago
comment:5 by , 10 years ago
| Milestone: | next-dev-1.1.x → 1.0.9 | 
|---|---|
| Owner: | set to | 
| Status: | new → assigned | 
comment:6 by , 10 years ago
| Milestone: | 1.0.9 → 1.2 | 
|---|
Patch looks good. I added a few additional minor changes in log:rjollos.git:t11938.
comment:8 by , 10 years ago
| Release Notes: | modified (diff) | 
|---|---|
| Resolution: | → fixed | 
| Status: | assigned → closed | 
Committed to trunk in [14210:14211].
comment:9 by , 10 years ago
| Owner: | changed from to | 
|---|
comment:10 by , 10 years ago
| Owner: | changed from to | 
|---|



  
pls let me know if unit test is needed..