use of org.eclipse.sw360.datahandler.permissions.PermissionUtils.makePermission in project sw360portal by sw360.
the class WhenComputePermissions method the_highest_allowed_action_is_computed_for_user_$_with_user_group_$_and_department_$.
public WhenComputePermissions the_highest_allowed_action_is_computed_for_user_$_with_user_group_$_and_department_$(@Quoted String userEmail, @TEnumToString UserGroup userGroup, @Quoted String userDept) {
final User user = new User(DUMMY_ID, userEmail, userDept).setUserGroup(userGroup);
final DocumentPermissions<Project> projectDocumentPermissions = PermissionUtils.makePermission(project, user);
allowedActions = projectDocumentPermissions.getAllAllowedActions();
return self();
}
use of org.eclipse.sw360.datahandler.permissions.PermissionUtils.makePermission in project sw360portal by sw360.
the class ProjectPortlet method prepareDetailView.
private void prepareDetailView(RenderRequest request, RenderResponse response) throws IOException, PortletException {
User user = UserCacheHolder.getUserFromRequest(request);
String id = request.getParameter(PROJECT_ID);
request.setAttribute(DOCUMENT_TYPE, SW360Constants.TYPE_PROJECT);
request.setAttribute(DOCUMENT_ID, id);
request.setAttribute(DEFAULT_LICENSE_INFO_HEADER_TEXT, getProjectDefaultLicenseInfoHeaderText());
if (id != null) {
try {
ProjectService.Iface client = thriftClients.makeProjectClient();
Project project = client.getProjectById(id, user);
project = getWithFilledClearingStateSummary(project, user);
request.setAttribute(PROJECT, project);
setAttachmentsInRequest(request, project.getAttachments());
List<ProjectLink> mappedProjectLinks = createLinkedProjects(project, user);
request.setAttribute(PROJECT_LIST, mappedProjectLinks);
putDirectlyLinkedReleasesInRequest(request, project);
Set<Project> usingProjects = client.searchLinkingProjects(id, user);
request.setAttribute(USING_PROJECTS, usingProjects);
putReleasesAndProjectIntoRequest(request, id, user);
putVulnerabilitiesInRequest(request, id, user);
request.setAttribute(VULNERABILITY_RATINGS_EDITABLE, PermissionUtils.makePermission(project, user).isActionAllowed(RequestedAction.WRITE));
addProjectBreadcrumb(request, response, project);
} catch (TException e) {
log.error("Error fetching project from backend!", e);
setSW360SessionError(request, ErrorMessages.ERROR_GETTING_PROJECT);
}
}
}
Aggregations