Modify

Opened 3 years ago

Closed 3 years ago

#13958 closed defect (fixed)

Milestone not shown on roadmap page

Reported by: Cinc-th Owned by: Cinc-th
Priority: normal Component: SimpleMultiProjectPlugin
Severity: normal Keywords:
Cc: Trac Release: 1.2

Description

A milestone which is assigned to a restricted project is not shown on the roadmap page even if the user has project permission.

The restricted project is shown in the project selector so the permission seems to be correct.

Attachments (0)

Change History (2)

comment:1 Changed 3 years ago by Cinc-th

In file permission.py:

simplemultiprojectplugin/trunk/simplemultiproject/permission.py@17996:178#L160

Line 
160    def check_milestone_permission(self, milestone, perm):
161        """Check if user has access to this milestone. Returns True if access is possible otherwise False.
162
163        :param milestone: name of milestone (resource.id)
164        :param perm: PermissionCache object
165        :return True if access permitted, False otherwise
166        """
167        # dict with key: milestone, val: list of project ids
168        milestones = defaultdict(list)
169        for ms in self.smp_milestone.get_all_milestones_and_id_project_id():
170            milestones[ms[0]].append(ms[1])
171
172        project_ids = milestones[milestone]
173        if not project_ids:
174            # This is a milestone without associated project. It was inserted by defaultdict during
175            # first access. With normal dict this would have been a KeyError.
176            return True
177        else:
178            filtered_prjs = self.smp_project.apply_user_restrictions(self.smp_project.get_all_projects(), perm)
179            allowed_prjs = [prj.id for prj in filtered_prjs]
180            for project in project_ids:
181                if project in allowed_prjs:
182                    return True
183
184        return False

The function is called with wrong positional parameter perm:

def apply_user_restrictions(self, projects, username=None, perms=None):

comment:2 Changed 3 years ago by Cinc-th

Resolution: fixed
Status: newclosed

In 17997:

SimpleMultiProjectPlugin: fixed permission handling for milestones of restricted projects.

Closes #13958

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Cinc-th.
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.