forked from chpladmin/chpl-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'ver-47.7.0' into production
- Loading branch information
Showing
31 changed files
with
807 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...main/java/gov/healthit/chpl/permissions/domains/listingUpload/ParseActionPermissions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package gov.healthit.chpl.permissions.domains.listingUpload; | ||
|
||
import java.util.List; | ||
|
||
import org.springframework.stereotype.Component; | ||
|
||
import gov.healthit.chpl.domain.ListingUpload; | ||
import gov.healthit.chpl.permissions.domains.ActionPermissions; | ||
|
||
@Component("parseListingUploadActionPermissions") | ||
public class ParseActionPermissions extends ActionPermissions { | ||
|
||
@Override | ||
public boolean hasAccess() { | ||
return getResourcePermissions().isUserRoleAdmin() | ||
|| getResourcePermissions().isUserRoleOnc() | ||
|| getResourcePermissions().isUserRoleAcbAdmin(); | ||
} | ||
|
||
@Override | ||
public boolean hasAccess(Object obj) { | ||
if (obj instanceof ListingUpload) { | ||
return hasAccess((ListingUpload) obj); | ||
} else if (obj instanceof List<?>) { | ||
boolean hasAccessToAll = true; | ||
for (Object listItem : (List<?>) obj) { | ||
if (listItem instanceof ListingUpload) { | ||
hasAccessToAll = hasAccessToAll && hasAccess((ListingUpload) listItem); | ||
} else { | ||
hasAccessToAll = false; | ||
} | ||
} | ||
return hasAccessToAll; | ||
} | ||
return false; | ||
} | ||
|
||
private boolean hasAccess(ListingUpload uploadedMetadata) { | ||
if (getResourcePermissions().isUserRoleAdmin()) { | ||
return true; | ||
} else if (getResourcePermissions().isUserRoleAcbAdmin() && uploadedMetadata.getAcb() != null) { | ||
return isAcbValidForCurrentUser(uploadedMetadata.getAcb().getId()); | ||
} | ||
return false; | ||
} | ||
} |
Oops, something went wrong.