Edgewall Software

Ticket #7258 (new defect)

Opened 8 months ago

Last modified 7 weeks ago

Can't set owner to $USER in a query when restrict_owner is on

Reported by: Kamil Kisiel <kamil@…> Owned by: osimons
Priority: normal Milestone: 0.11-retriage
Component: report system Version: 0.11rc1
Severity: normal Keywords:
Cc:

Description

Using the $USER variable normally allows you to specify the currently logged in user in a query, but there doesn't appear to be any way to achieve this when the restrict_owner option is set.

Attachments

Change History

Changed 8 months ago by cboos

  • keywords verify added
  • milestone set to 0.11.1

Changed 6 months ago by osimons

  • keywords verify removed
  • owner changed from mgood to osimons

The issue is correctly stated.

Seeing 'reporter' with flexible options like 'is', 'is not', 'contains' and so on makes me wish for the same for 'owner' even with restrict_owner enabled. For reporting purposes that makes a lot of sense.

And, there is also an e-mail obfuscation issue involved: anyone with just TICKET_VIEW permission will get it obfuscated when viewing a specific ticket (properties are not available with just view), but in Custom Query it shows up as a filter unmodified.

+1 on making 'owner' like 'reporter' regardless of restrict_owner setting.

Changed 6 months ago by osimons

  • milestone changed from 0.11.2 to 0.11.1

When fixing this, also remember to test the issue of reopened comment:ticket:1467:14.

Changed 6 months ago by osimons

Here is a patch to fix make the field 'owner' field always behave like a text field regardless of setting:

  • more flexible querying using also contains, startswith, endswith and so on.
  • supports $USER.
  • e-mail obfuscation is no longer an issue if username is an email address and user only has TICKET_VIEW permissions.
  • trac/ticket/query.py

     
    593593        for field in self.fields: 
    594594            if field['type'] == 'textarea': 
    595595                continue 
     596            if field['name'] == 'owner' and field['type'] == 'select': 
     597                # restrict_owner = true => make it a regular text field instead 
     598                field['type'] = 'text' 
     599                del field['options'] 
    596600            field_data = {} 
    597601            field_data.update(field) 
    598602            del field_data['name'] 

Does other devs agree with this change?

Changed 5 months ago by osimons

  • milestone changed from 0.11.1 to 0.11.2

Remember seeing some other tickets and discussions that want similar treatment for versions, milestones, components and all similar select fields ('all versions starting with 0.10...'), and perhaps the right way to go about this is an option in the trac.ini [query] section that turns a switch to convert all select fields to regular text fields?

Changed 7 weeks ago by rblank

Another option would be to artificially add a $USER value in the query select box for the owner. Still, having "contains", "startswith" and other modes is useful, so I tend to prefer comment:4.

Add/Change #7258 (Can't set owner to $USER in a query when restrict_owner is on)

Author



Change Properties
<Author field>
Action
as new
as The resolution will be set. Next status will be 'closed'
to The owner will change from osimons. Next status will be 'new'
The owner will change from osimons to anonymous. Next status will be 'assigned'
 
Note: See TracTickets for help on using tickets.