Skip to content

Commit

Permalink
Merge pull request #3009 from AtlasOfLivingAustralia/feature/issue3008
Browse files Browse the repository at this point in the history
Feature/issue3008
  • Loading branch information
salomon-j authored Oct 20, 2023
2 parents d8fa181 + c862eb3 commit fe74b21
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,6 @@ grails-app/assets/vendor-ext
/build/
/.gradle/
/grails-app/assets/components/compile/templates.js
/ehcache/.lock
/ehcache/file/homePageStatistics_c96622e3da276e1ccd3532e6f1f975756232b01a/offheap-disk-store/ehcache-disk-store.data
/ehcache/file/homePageStatistics_c96622e3da276e1ccd3532e6f1f975756232b01a/offheap-disk-store/ehcache-disk-store.meta
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@ class ProjectController {
} else {
project.sites?.sort { it.name }
project.projectSite = project.sites?.find { it.siteId == project.projectSiteId }
def roles = roleService.getRoles()
List roles = roleService.getRoles()
if (config.supportsParatoo) {
roles = roles + [RoleService.PROJECT_SURVEYOR_ROLE]
}

def members = projectService.getMembersForProjectId(id)
def admins = members.findAll { it.role == "admin" }.collect { it.userName }.join(",")
Expand Down
1 change: 1 addition & 0 deletions grails-app/i18n/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ label.F=<i class=\"icon-remove\"></i>
label.role.admin=Admin
label.role.caseManager=Grant Manager
label.role.editor=Editor
label.role.projectParticipant=Field Data Collector
label.docType=Type
label.project=Project
label.site=Site
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ class MetadataService {

def getAccessLevels() {
return cacheService.get('accessLevels',{
webService.getJson(grailsApplication.config.getProperty('ecodata.baseUrl') + "permissions/getAllAccessLevels")
webService.getJson(grailsApplication.config.getProperty('ecodata.baseUrl') + "permissions/getAllAccessLevels?baseLevel=${RoleService.PROJECT_SURVEYOR_ROLE}")
})
}

Expand Down
4 changes: 2 additions & 2 deletions grails-app/services/au/org/ala/merit/RoleService.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class RoleService {
public static final String PROJECT_FC_READ_ONLY_ROLE = 'ROLE_FC_READ_ONLY'
public static final String PROJECT_FC_OFFICER_ROLE = 'ROLE_FC_OFFICER'
public static final String PROJECT_FC_ADMIN_ROLE = 'ROLE_FC_ADMIN'

public static final String PROJECT_SURVEYOR_ROLE = 'projectParticipant'

/**
* A check against this role will pass if the user has any hub or any Project role. This is more of a permission
Expand Down Expand Up @@ -105,7 +105,7 @@ class RoleService {
}

Set getAllowedUserRoles() {
return new HashSet([PROJECT_ADMIN_ROLE, PROJECT_EDITOR_ROLE])
return new HashSet([PROJECT_ADMIN_ROLE, PROJECT_EDITOR_ROLE, PROJECT_SURVEYOR_ROLE])
}

public Set getHubRoles() {
Expand Down
6 changes: 5 additions & 1 deletion grails-app/views/admin/_permissionTable.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@
$clone.find('.memUserName').text(el.displayName);
$clone.find('.memUserRole select').val(el.role);
$clone.find('.memUserRole select').attr("id", el.userId);
$clone.find('.memUserRole span').text(decodeCamelCase(el.role).replace('Case','Grant')); // TODO: i18n this
var roleName = decodeCamelCase(el.role).replace('Case','Grant');
if (_.isFunction(window.$i18n)) {
roleName = $i18n('label.role.'+el.role, roleName);
}
$clone.find('.memUserRole span').text(roleName);
$('.membersTbody').append($clone);
});
} else {
Expand Down

0 comments on commit fe74b21

Please sign in to comment.