2019-10-14 10:18:54 +02:00
|
|
|
package org.gcube.common.storagehub.client.dsl;
|
|
|
|
|
2020-01-15 19:10:33 +01:00
|
|
|
import java.util.List;
|
|
|
|
|
2019-10-14 10:18:54 +02:00
|
|
|
import org.gcube.common.storagehub.client.proxies.GroupManagerClient;
|
|
|
|
import org.gcube.common.storagehub.client.proxies.WorkspaceManagerClient;
|
2020-01-16 18:11:46 +01:00
|
|
|
import org.gcube.common.storagehub.model.acls.AccessType;
|
2019-10-14 10:18:54 +02:00
|
|
|
import org.gcube.common.storagehub.model.exceptions.StorageHubException;
|
|
|
|
|
|
|
|
public class VREFolderManager {
|
|
|
|
|
2022-03-28 18:28:06 +02:00
|
|
|
//private WorkspaceManagerClient wsClient;
|
2019-10-14 10:18:54 +02:00
|
|
|
private GroupManagerClient groupClient;
|
|
|
|
|
2020-01-15 19:10:33 +01:00
|
|
|
private String vreTitle;
|
|
|
|
|
2022-03-28 18:28:06 +02:00
|
|
|
protected VREFolderManager(WorkspaceManagerClient wsClient, GroupManagerClient groupClient, String vreTitle) {
|
2019-10-14 10:18:54 +02:00
|
|
|
super();
|
2022-03-28 18:28:06 +02:00
|
|
|
//this.wsClient = wsClient;
|
2019-10-14 10:18:54 +02:00
|
|
|
this.groupClient = groupClient;
|
2020-01-15 19:10:33 +01:00
|
|
|
this.vreTitle = vreTitle;
|
2019-10-14 10:18:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public void removeUser(String userId) throws StorageHubException{
|
2020-01-15 19:10:33 +01:00
|
|
|
groupClient.removeUserFromGroup(userId, vreTitle);
|
2019-10-14 10:18:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public void addUser(String userId) throws StorageHubException{
|
2020-01-15 19:10:33 +01:00
|
|
|
groupClient.addUserToGroup(userId, vreTitle);
|
2019-10-14 10:18:54 +02:00
|
|
|
}
|
|
|
|
|
2020-01-15 19:10:33 +01:00
|
|
|
public List<String> getUsers() throws StorageHubException{
|
|
|
|
return groupClient.getUsersOfGroup(vreTitle);
|
2019-10-14 10:18:54 +02:00
|
|
|
}
|
2020-01-15 19:10:33 +01:00
|
|
|
|
2020-01-16 18:11:46 +01:00
|
|
|
/*private Item getVreFolder() {
|
2019-10-14 10:18:54 +02:00
|
|
|
return wsClient.getVreFolder(Excludes.ALL.toArray(new String[0]));
|
2020-01-16 18:11:46 +01:00
|
|
|
}*/
|
2020-01-15 19:10:33 +01:00
|
|
|
|
|
|
|
public void setAdmin(String userId) throws StorageHubException{
|
|
|
|
groupClient.addAdmin(vreTitle, userId);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void removeAdmin(String userId) throws StorageHubException{
|
|
|
|
groupClient.removeAdmin(vreTitle, userId);
|
|
|
|
}
|
|
|
|
|
|
|
|
public List<String> getAdmins() throws StorageHubException{
|
|
|
|
return groupClient.getAdmins(vreTitle);
|
|
|
|
}
|
2020-01-16 18:11:46 +01:00
|
|
|
|
|
|
|
public void createVRE(AccessType accessType, String folderOwner) throws StorageHubException{
|
|
|
|
groupClient.createGroup(vreTitle, accessType, folderOwner);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void removeVRE() throws StorageHubException{
|
|
|
|
groupClient.removeGroup(vreTitle);
|
|
|
|
}
|
2020-01-15 19:10:33 +01:00
|
|
|
|
2019-10-14 10:18:54 +02:00
|
|
|
}
|