Skip to content

Commit

Permalink
Fix a bug where user groups on a project with manager permission were…
Browse files Browse the repository at this point in the history
… not allowed to behave like managers.
  • Loading branch information
Franklin Bristow committed Jun 1, 2016
1 parent be09ef0 commit 0c166a8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 16 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Changes
* [Database] Fixed an issue with migrating single end sequence files to the new SequencingObject model in cases where samples with single files had been merged. IRIDA installs should skip directly to v1.0.2 from 1.0.0alpha-10 to avoid database update problems. (1.0.2)
* [UI]: Fixed a bug where the `hashCode` method on `SequenceFilePair` was *only* using the date the pair was created, causing `Set`s of pairs to be much smaller than expected. (1.0.3)
* [Developer]: Re-fixed the `hashCode` bug so that the files collection is a `List` instead of a `Set`. The `Set` was throwing a `NullPointerException` from Hibernate. (1.0.4)
* [UI]: Fixed a bug where groups on a project with manager role were not allowed to behave like a manager. (1.0.5)

1.0.0-alpha10 to 1.0.0
----------------------
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>ca.corefacility.bioinformatics</groupId>
<artifactId>irida</artifactId>
<packaging>war</packaging>
<version>1.0.4</version>
<version>1.0.5</version>
<name>irida</name>
<url>http://www.irida.ca</url>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
package ca.corefacility.bioinformatics.irida.ria.web.projects;

import java.security.Principal;
import java.util.Collection;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Component;
import org.springframework.ui.Model;

import ca.corefacility.bioinformatics.irida.model.enums.ProjectRole;
import ca.corefacility.bioinformatics.irida.model.joins.Join;
import ca.corefacility.bioinformatics.irida.model.project.Project;
import ca.corefacility.bioinformatics.irida.model.user.Role;
import ca.corefacility.bioinformatics.irida.model.user.User;
import ca.corefacility.bioinformatics.irida.security.permissions.ProjectOwnerPermission;
import ca.corefacility.bioinformatics.irida.service.user.UserService;

/**
Expand All @@ -23,10 +22,13 @@
public class ProjectControllerUtils {
// Services
private final UserService userService;

private final ProjectOwnerPermission projectOwnerPermission;

@Autowired
public ProjectControllerUtils(UserService userService) {
public ProjectControllerUtils(final UserService userService, final ProjectOwnerPermission projectOwnerPermission) {
this.userService = userService;
this.projectOwnerPermission = projectOwnerPermission;
}

/**
Expand All @@ -50,18 +52,9 @@ public void getProjectTemplateDetails(Model model, Principal principal, Project
boolean isAdmin = loggedInUser.getSystemRole().equals(Role.ROLE_ADMIN);
model.addAttribute("isAdmin", isAdmin);

// Find out who the owner of the project is.
Collection<Join<Project, User>> ownerJoinList = userService.getUsersForProjectByRole(project,
ProjectRole.PROJECT_OWNER);
boolean isOwner = false;
for (Join<Project, User> owner : ownerJoinList) {
if (loggedInUser.equals(owner.getObject())) {
isOwner = true;
}
}
boolean isOwner = projectOwnerPermission.isAllowed(SecurityContextHolder.getContext().getAuthentication(),
project);

model.addAttribute("isOwner", isOwner);

// TODO: (Josh - 14-06-23) Get list of recent activities on project.
}
}

0 comments on commit 0c166a8

Please sign in to comment.