Merge remote-tracking branch 'origin/master' into beta

This commit is contained in:
Konstantinos Triantafyllou 2023-11-14 13:21:28 +02:00
commit 51bdeb5e1e
3 changed files with 16 additions and 76 deletions

View File

@ -29,7 +29,7 @@
<dependency> <!-- this dependency includes dependency to uoa-authorization-library -->
<groupId>eu.dnetlib</groupId>
<artifactId>uoa-admin-tools-library</artifactId>
<version>1.0.8</version>
<version>1.0.9</version>
</dependency>
<dependency>
<groupId>eu.dnetlib</groupId>

View File

@ -9,9 +9,11 @@ import java.util.List;
enum StakeholderType
{
// Do not rename or remove existring values. This may cause problems with already stored values in DB
// Do not rename or remove existing values. This may cause problems with already stored values in DB
funder, ri, project, organization,
FUNDER, RI, PROJECT, ORGANIZATION;
country, researcher, datasource,
FUNDER, RI, PROJECT, ORGANIZATION,
COUNTRY, RESEARCHER, DATASOURCE;
}
enum Locale {
@ -19,7 +21,7 @@ enum Locale {
public final String label;
private Locale(String label) {
Locale(String label) {
this.label = label;
}
}
@ -44,6 +46,7 @@ public class Stakeholder<StringOrTopic> {
private String defaultId = null;
private Locale locale = Locale.EU;
private Visibility visibility = Visibility.PRIVATE;
private String funderType;
private Date creationDate;
private Date updateDate;
@ -68,6 +71,7 @@ public class Stakeholder<StringOrTopic> {
defaultId = stakeholder.getDefaultId();
setLocale(stakeholder.getLocale());
setVisibility(stakeholder.getVisibility());
this.funderType = stakeholder.getFunderType();
creationDate = stakeholder.getCreationDate();
updateDate = stakeholder.getUpdateDate();
}
@ -212,6 +216,14 @@ public class Stakeholder<StringOrTopic> {
this.visibility = visibility;
}
public String getFunderType() {
return funderType;
}
public void setFunderType(String funderType) {
this.funderType = funderType;
}
public Date getCreationDate() {
return creationDate;
}

View File

@ -1,72 +0,0 @@
//package eu.dnetlib.uoamonitorservice.handlers.utils;
//
//import eu.dnetlib.uoaauthorizationlibrary.security.AuthorizationService;
//import org.apache.log4j.Logger;
//
//import java.util.List;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//
//@Component
//public class RolesUtils {
// @Autowired
// private AuthorizationService authorizationService;
//
// private final Logger log = Logger.getLogger(this.getClass());
//
// public List<String> getRoles() {
// return authorizationService.getRoles();
// }
//
// public boolean isPortalAdmin(List<String> roles) {
// if(roles == null) {
// return false;
// }
//// log.debug(authorizationService.PORTAL_ADMIN);
//// log.debug("PortalAdmin: "+roles.contains(authorizationService.PORTAL_ADMIN));
// return roles.contains(authorizationService.PORTAL_ADMIN);
// }
//
// public boolean isCurator(List<String> roles, String type) {
// if(roles == null) {
// return false;
// }
//// log.debug(authorizationService.curator(type));
//// log.debug("Curator in "+type+": "+roles.contains(authorizationService.curator(type)));
// return roles.contains(authorizationService.curator(type));
// }
//
// public boolean isManager(List<String> roles, String type, String id) {
// if(roles == null) {
// return false;
// }
//// log.debug(authorizationService.manager(type, id));
//// log.debug("Manager in "+type+" - "+id+": "+roles.contains(authorizationService.manager(type, id)));
// return roles.contains(authorizationService.manager(type, id));
// }
//
// public boolean isMember(List<String> roles, String type, String id) {
// if(roles == null) {
// return false;
// }
//// log.debug(authorizationService.member(type, id));
//// log.debug("Member in "+type+" - "+id+": "+roles.contains(authorizationService.member(type, id)));
// return roles.contains(authorizationService.member(type, id));
// }
//
// public boolean isLoggedIn(List<String> roles) {
// if(roles == null || roles.contains(authorizationService.ANONYMOUS_USER)) {
// return false;
// }
// return true;
// }
//
// public boolean hasUpdateAuthority(List<String> roles, String type, String id) {
// return isPortalAdmin(roles) || isCurator(roles, type) || isManager(roles, type, id);
// }
//
// public boolean hasCreateAndDeleteAuthority(List<String> roles, String type) {
// return isPortalAdmin(roles) || isCurator(roles, type);
// }
//}