Modify

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#13322 closed defect (fixed)

Operation on unwanted places

Reported by: ntmlod Owned by: jomae
Priority: normal Component: GridModifyPlugin
Severity: normal Keywords:
Cc: Trac Release: 1.0

Description (last modified by ntmlod)

The plugin has a little tendency to work on other tables, for example the history of a wiki page where the version numbers are replaced by dropdown menu with code versions.

Perhaps the best way to handle this is to limit to /query & /report href pages and tables generated with [[TicketQuery()]].

Attachments (3)

admin-permissions.png (39.4 KB) - added by Jun Omae 7 years ago.
console-permissions.png (27.6 KB) - added by Jun Omae 7 years ago.
Missing_grid_perm.png (83.3 KB) - added by ntmlod 7 years ago.

Download all attachments as: .zip

Change History (15)

comment:1 Changed 7 years ago by ntmlod

Description: modified (diff)

comment:2 Changed 7 years ago by Jun Omae

Root cause is the following expression in filter_stream().

        if filename in ('query.html', 'report_view.html') and \
                'TICKET_ADMIN' in req.perm or \
                'TICKET_GRID_MODIFY' in req.perm:

It should be:

        if filename in ('query.html', 'report_view.html') and \
                ('TICKET_ADMIN' in req.perm or 'TICKET_GRID_MODIFY' in req.perm):

However, it would be simplified to group TICKET_GRID_MODIFY in TICKET_ADMIN.

  • gridmodifyplugin/trunk/gridmod/web_ui.py

    diff --git a/gridmodifyplugin/trunk/gridmod/web_ui.py b/gridmodifyplugin/trunk/gridmod/web_ui.py
    index 88119fadc..7550d3b3f 100644
    a b class GridModifyModule(Component): 
    3434
    3535    def get_permission_actions(self):
    3636        yield 'TICKET_GRID_MODIFY'
     37        yield 'TICKET_ADMIN', ['TICKET_GRID_MODIFY']
    3738
    3839    # ITemplateProvider methods
    3940
    class GridModifyModule(Component): 
    5152
    5253    def process_request(self, req):
    5354        try:
    54             if 'TICKET_ADMIN' in req.perm or 'TICKET_GRID_MODIFY' in req.perm:
     55            if 'TICKET_GRID_MODIFY' in req.perm:
    5556
    5657                id = as_int(req.args.get('ticket'), None)
    5758                ticket = Ticket(self.env, id)
    class GridModifyModule(Component): 
    122123        # tag values. JQuery then uses this information to update the
    123124        # relevant fields on the page.
    124125        if filename in ('query.html', 'report_view.html') and \
    125                 'TICKET_ADMIN' in req.perm or \
    126126                'TICKET_GRID_MODIFY' in req.perm:
    127127            add_script(req, 'gridmod/gridmod.js')
    128128            div = html.div(id='table_inits_holder', style='display:none;')

Could you please try it?

comment:3 Changed 7 years ago by Jun Omae

Also, the plugin doesn't work on the table generated by TicketQuery macro.

comment:4 Changed 7 years ago by Ryan J Ollos

Status: newaccepted

Thanks, regression in [16202#file3].

comment:5 in reply to:  3 ; Changed 7 years ago by ntmlod

  • gridmodifyplugin/trunk/gridmod/web_ui.py

     
    3333    # IPermissionRequestor methods
    3434
    3535    def get_permission_actions(self):
    36         yield 'TICKET_GRID_MODIFY'
     36        yield 'TICKET_ADMIN', ['TICKET_GRID_MODIFY']
    3737
    3838    # ITemplateProvider methods
    3939
     
    5151
    5252    def process_request(self, req):
    5353        try:
    54             if 'TICKET_ADMIN' in req.perm or 'TICKET_GRID_MODIFY' in req.perm:
     54            if 'TICKET_GRID_MODIFY' in req.perm:
    5555
    5656                id = as_int(req.args.get('ticket'), None)
    5757                ticket = Ticket(self.env, id)
     
    122122        # tag values. JQuery then uses this information to update the
    123123        # relevant fields on the page.
    124124        if filename in ('query.html', 'report_view.html') and \
    125                 'TICKET_ADMIN' in req.perm or \
    126125                'TICKET_GRID_MODIFY' in req.perm:
    127126            add_script(req, 'gridmod/gridmod.js')
    128127            div = html.div(id='table_inits_holder', style='display:none;')

The version history for wiki pages has been restored.
I think I encountered the problem in another page but I can't remember which. Probably this fix solves it.

Replying to Jun Omae:

Also, the plugin doesn't work on the table generated by TicketQuery macro.

I didn't try to change a field trough this but I see dropdown menus fro TicketQuery tables

comment:6 Changed 7 years ago by ntmlod

After review TICKET_GRID_MODIFY is no longer in the permissions list, the first change shouldn't it be:

  • gridmod/web_ui.py

     
    3333    # IPermissionRequestor methods
    3434
    3535    def get_permission_actions(self):
    36        yield 'TICKET_GRID_MODIFY'
     36       return [('TICKET_ADMIN', ['TICKET_GRID_MODIFY']), 'TICKET_GRID_MODIFY']
    3737
    3838    # ITemplateProvider methods

Changed 7 years ago by Jun Omae

Attachment: admin-permissions.png added

Changed 7 years ago by Jun Omae

Attachment: console-permissions.png added

comment:7 Changed 7 years ago by Jun Omae

Wired. TICKET_GRID_MODIFY is definitely listed.

comment:8 in reply to:  5 ; Changed 7 years ago by Jun Omae

Replying to Jun Omae:

Also, the plugin doesn't work on the table generated by TicketQuery macro.

I didn't try to change a field trough this but I see dropdown menus fro TicketQuery tables

No. That is unintentional behavior which is probably introduced in [16202].

Changed 7 years ago by ntmlod

Attachment: Missing_grid_perm.png added

comment:9 in reply to:  8 Changed 7 years ago by ntmlod

Replying to Jun Omae:

Replying to Jun Omae:

Also, the plugin doesn't work on the table generated by TicketQuery macro.

I didn't try to change a field trough this but I see dropdown menus fro TicketQuery tables

No. That is unintentional behavior which is probably introduced in [16202].

You're right, it's no longer the case now.

Back to permission issue, my screenshot is not very good but you can see the permission TICKET_GRID_MODIFY is grey and with some heed not in the list from the dropdown menu.

comment:10 Changed 7 years ago by Ryan J Ollos

In 16953:

GridModify 1.0.0dev: TICKET_ADMIN grants TICKET_GRID_MODIFY

This fixes a regression in r16202.

Refs #13322.

comment:11 Changed 7 years ago by Ryan J Ollos

Resolution: fixed
Status: acceptedclosed

comment:12 Changed 7 years ago by Ryan J Ollos

Owner: changed from Ryan J Ollos to jomae

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain jomae.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.