return; else if (authorizationService.canCreateProject(user)) { projectBizService.updateProject(project, user); resp.setCharacterEncoding("UTF-8");
if (authzService.canDepositToCollection(user, collection)) {
if (authorizationService.canReadProject(user, project)) { resp.setCharacterEncoding("UTF-8"); resp.setContentType("text/xml");
canUpdate = authorizationService.canUpdateProject(user, (Project) parent); } else if (parent instanceof Collection) { try{ canUpdate = authorizationService.canUpdateCollection(user, (Collection)parent); } catch (RelationshipConstraintException rce) { throw new BizInternalException("Relationship Constraint Exception thrown while authorizing " + try { Collection collection = relationshipService.getCollectionForDataSet((DataItem) parent); canUpdate = authorizationService.canDepositToCollection(user, collection); } catch (RelationshipConstraintException rce) { throw new BizInternalException("Relationship Constraint Exception thrown while authorizing " + DataItem dataItem = relationshipService.getDataSetForDataFileId(parentId); collection = relationshipService.getCollectionForDataSet(dataItem); canUpdate = authorizationService.canDepositToCollection(user, collection); done = true; } catch (RelationshipConstraintException e) { DataItem dataItem = retrieveDataSet(parentId); collection = relationshipService.getCollectionForDataSet(dataItem); canUpdate = authorizationService.canDepositToCollection(user, collection); done = true; } catch (ArchiveServiceException e) { try{ collection = retrieveCollection(parentId); canUpdate = authorizationService.canDepositToCollection(user, collection); done = true;
private List<DataItem> get_versions(String business_id, Person user) throws ArchiveServiceException, BizPolicyException { /*if (user == null) { throw new BizPolicyException( "You must be logged in to access files.", Type.AUTHENTICATION_ERROR); }*/ List<DataItem> result = new ArrayList<DataItem>(); for (ArchiveDepositInfo info : archiveService.listDepositInfo( business_id, Status.DEPOSITED)) { // TODO: Only one DataItem can be matched by deposit id. Should // refactor ArchiveService. ArchiveSearchResult<DataItem> sr = archiveService .retrieveDataSet(info.getDepositId()); for (DataItem ds : sr.getResults()) { if (!authService.canRetrieveDataSet(user, ds)) { throw new BizPolicyException( "This user is not authorized to retrieve DataItem: " + ds, Type.AUTHORIZATION_ERROR); } result.add(ds); } } return result; }
if (!authorizationService.canRetrieveCollection(user, collection)) { throw new BizPolicyException("This user is not authorized to retrieve the given collection", BizPolicyException.Type.AUTHORIZATION_ERROR);
if (authorizationService.canUpdateProject(user, newProject)) { projectBizService.updateProject(newProject, user);
@Override public Set<Collection> getCollectionsForProject(Project project, Person user) throws BizPolicyException { // Verify that the user is who they say they are user = UserVerificationUtil.VerifyUser(userService, user); Set<Collection> collections = new HashSet<Collection>(); if (project == null) { collections = null; } else { if (!authorizationService.canRetrieveProjectCollections(user, project)) { if (user == null) { throw new BizPolicyException("Please login to view collections of the given project.", Type.AUTHENTICATION_ERROR); } else { throw new BizPolicyException( "This user is not authorized to view collections of the given project.", Type.AUTHORIZATION_ERROR); } } else { collections = relationshipService.getCollectionsForProject(project); } } return collections; }
if (file != null && !authService.canRetrieveDataFile(user, (DataFile) file)) { if (user == null) { throw new BizPolicyException("Please log in to retrieve the given file.",
canUpdate = authorizationService.canUpdateCollection(user, collection); } catch (RelationshipConstraintException rce) { throw new BizInternalException("Relationship Constraint Exception thrown while authorizing "
if (!authorizationService.canCreateCollection(user, project)) { throw new BizPolicyException ("User does not have permission to create collection under the identified project", if (!authorizationService.canCreateCollection(user, parentCollection)) { throw new BizPolicyException ("User does not have permission to create collection under the identified project",
canUpdate = authorizationService.canUpdateProject(user, (Project) parent); } else if (parent instanceof Collection) { try{ canUpdate = authorizationService.canUpdateCollection(user, (Collection)parent); } catch (RelationshipConstraintException rce) { throw new BizInternalException("Relationship Constraint Exception thrown while authorizing " + try { Collection collection = relationshipService.getCollectionForDataSet((DataItem) parent); canUpdate = authorizationService.canDepositToCollection(user, collection); } catch (RelationshipConstraintException rce) { throw new BizInternalException("Relationship Constraint Exception thrown while authorizing " + DataItem dataItem = relationshipService.getDataSetForDataFileId(parentId); collection = relationshipService.getCollectionForDataSet(dataItem); canUpdate = authorizationService.canDepositToCollection(user, collection); done = true; } catch (RelationshipConstraintException e) { DataItem dataItem = retrieveDataSet(parentId); collection = relationshipService.getCollectionForDataSet(dataItem); canUpdate = authorizationService.canDepositToCollection(user, collection); done = true; } catch (ArchiveServiceException e) { try{ collection = retrieveCollection(parentId); canUpdate = authorizationService.canDepositToCollection(user, collection); done = true;
private List<DataItem> get_versions(String business_id, Person user) throws ArchiveServiceException, BizPolicyException { /*if (user == null) { throw new BizPolicyException( "You must be logged in to access files.", Type.AUTHENTICATION_ERROR); }*/ List<DataItem> result = new ArrayList<DataItem>(); for (ArchiveDepositInfo info : archiveService.listDepositInfo( business_id, Status.DEPOSITED)) { // TODO: Only one DataItem can be matched by deposit id. Should // refactor ArchiveService. ArchiveSearchResult<DataItem> sr = archiveService .retrieveDataSet(info.getDepositId()); for (DataItem ds : sr.getResults()) { if (!authService.canRetrieveDataSet(user, ds)) { throw new BizPolicyException( "This user is not authorized to retrieve DataItem: " + ds, Type.AUTHORIZATION_ERROR); } result.add(ds); } } return result; }
if (!authorizationService.canRetrieveCollection(user, collection)) { throw new BizPolicyException("This user is not authorized to retrieve the given collection", BizPolicyException.Type.AUTHORIZATION_ERROR);
if (authorizationService.canUpdateProject(user, newProject)) { projectBizService.updateProject(newProject, user);
@Override public Set<Collection> getCollectionsForProject(Project project, Person user) throws BizPolicyException { // Verify that the user is who they say they are user = UserVerificationUtil.VerifyUser(userService, user); Set<Collection> collections = new HashSet<Collection>(); if (project == null) { collections = null; } else { if (!authorizationService.canRetrieveProjectCollections(user, project)) { if (user == null) { throw new BizPolicyException("Please login to view collections of the given project.", Type.AUTHENTICATION_ERROR); } else { throw new BizPolicyException( "This user is not authorized to view collections of the given project.", Type.AUTHORIZATION_ERROR); } } else { collections = relationshipService.getCollectionsForProject(project); } } return collections; }
if (file != null && !authService.canRetrieveDataFile(user, (DataFile) file)) { if (user == null) { throw new BizPolicyException("Please log in to retrieve the given file.",
canUpdate = authorizationService.canUpdateCollection(user, collection); } catch (RelationshipConstraintException rce) { throw new BizInternalException("Relationship Constraint Exception thrown while authorizing "
if (!authorizationService.canCreateCollection(user, project)) { throw new BizPolicyException ("User does not have permission to create collection under the identified project", if (!authorizationService.canCreateCollection(user, parentCollection)) { throw new BizPolicyException ("User does not have permission to create collection under the identified project",
if (authorizationService.canReadProject(user, project)) { resp.setCharacterEncoding("UTF-8"); resp.setContentType("text/xml");