Compare commits
3 Commits
master
...
feature/26
Author | SHA1 | Date |
---|---|---|
Luca Frosini | c6049a122b | |
Luca Frosini | 1e31a71fce | |
Luca Frosini | 0917263f27 |
|
@ -189,11 +189,18 @@ public class ContextManagement extends EntityElementManagement<Context, EntityTy
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private JsonNode filterFieldsByRole(JsonNode context) {
|
||||||
|
// TODO return extra info only to authorized users
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected JsonNode createCompleteJsonNode() throws ResourceRegistryException {
|
protected JsonNode createCompleteJsonNode() throws ResourceRegistryException {
|
||||||
|
|
||||||
JsonNode context = serializeSelfAsJsonNode();
|
JsonNode context = serializeSelfAsJsonNode();
|
||||||
|
|
||||||
|
context = filterFieldsByRole(context);
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
Iterable<OEdge> parents = getElement().getEdges(ODirection.IN);
|
Iterable<OEdge> parents = getElement().getEdges(ODirection.IN);
|
||||||
for (OEdge edge : parents) {
|
for (OEdge edge : parents) {
|
||||||
|
@ -235,6 +242,8 @@ public class ContextManagement extends EntityElementManagement<Context, EntityTy
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected OVertex reallyCreate() throws AlreadyPresentException, ResourceRegistryException {
|
protected OVertex reallyCreate() throws AlreadyPresentException, ResourceRegistryException {
|
||||||
SecurityContext securityContext = null;
|
SecurityContext securityContext = null;
|
||||||
|
@ -256,6 +265,7 @@ public class ContextManagement extends EntityElementManagement<Context, EntityTy
|
||||||
uuid = UUIDManager.getInstance().generateValidUUID();
|
uuid = UUIDManager.getInstance().generateValidUUID();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logFullPath();
|
||||||
createVertex();
|
createVertex();
|
||||||
|
|
||||||
IsParentOfManagement isParentOfManagement = new IsParentOfManagement(oDatabaseDocument);
|
IsParentOfManagement isParentOfManagement = new IsParentOfManagement(oDatabaseDocument);
|
||||||
|
@ -267,6 +277,7 @@ public class ContextManagement extends EntityElementManagement<Context, EntityTy
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
checkContext(null);
|
checkContext(null);
|
||||||
|
logFullPath();
|
||||||
createVertex();
|
createVertex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,6 +301,23 @@ public class ContextManagement extends EntityElementManagement<Context, EntityTy
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO
|
||||||
|
* The full path of the context is added for every non safe action
|
||||||
|
* - At creation time
|
||||||
|
* - At rename time (see #25139)
|
||||||
|
* - At parent change time (see #26544)
|
||||||
|
*
|
||||||
|
* In this way we are sure to track context fullpath changes.
|
||||||
|
* Furthermore when a context is delete and is mode to the cemetery
|
||||||
|
* i.e. ShadowContextSecurityContext (see #19428) we do not have to do nothing with
|
||||||
|
* the fullpath just move the vertex in the new SecurityContext
|
||||||
|
* and add the instance of context deletion
|
||||||
|
*/
|
||||||
|
protected void logFullPath() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected OVertex reallyUpdate() throws NotFoundException, ResourceRegistryException {
|
protected OVertex reallyUpdate() throws NotFoundException, ResourceRegistryException {
|
||||||
|
|
||||||
|
@ -361,6 +389,8 @@ public class ContextManagement extends EntityElementManagement<Context, EntityTy
|
||||||
move(newParentContextManagement, false);
|
move(newParentContextManagement, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logFullPath();
|
||||||
|
|
||||||
element = (OVertex) updateProperties(oClass, getElement(), jsonNode, ignoreKeys, ignoreStartWithKeys);
|
element = (OVertex) updateProperties(oClass, getElement(), jsonNode, ignoreKeys, ignoreStartWithKeys);
|
||||||
|
|
||||||
ServerContextCache.getInstance().cleanCache();
|
ServerContextCache.getInstance().cleanCache();
|
||||||
|
@ -406,6 +436,7 @@ public class ContextManagement extends EntityElementManagement<Context, EntityTy
|
||||||
thisSecurityContext.changeParentSecurityContext(newParentSecurityContext, oDatabaseDocument);
|
thisSecurityContext.changeParentSecurityContext(newParentSecurityContext, oDatabaseDocument);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void reallyDelete() throws NotFoundException, ResourceRegistryException {
|
protected void reallyDelete() throws NotFoundException, ResourceRegistryException {
|
||||||
Iterable<OEdge> iterable = getElement().getEdges(ODirection.OUT);
|
Iterable<OEdge> iterable = getElement().getEdges(ODirection.OUT);
|
||||||
|
@ -414,6 +445,7 @@ public class ContextManagement extends EntityElementManagement<Context, EntityTy
|
||||||
throw new ContextException("Cannot remove a " + Context.NAME + " having children");
|
throw new ContextException("Cannot remove a " + Context.NAME + " having children");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO Move the vertex to the ShadowContextSecurityContext (i.e the cemetery)
|
||||||
element.delete();
|
element.delete();
|
||||||
|
|
||||||
ContextUtility contextUtility = ContextUtility.getInstance();
|
ContextUtility contextUtility = ContextUtility.getInstance();
|
||||||
|
|
|
@ -12,6 +12,7 @@ import com.orientechnologies.orient.core.metadata.security.ORule;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Luca Frosini (ISTI - CNR)
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
|
* Added for feature #19428
|
||||||
*/
|
*/
|
||||||
public class ShadowContextSecurityContext extends SecurityContext {
|
public class ShadowContextSecurityContext extends SecurityContext {
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,8 @@ public class ContextTest {
|
||||||
public static final String PASSWORD_PROPERTY_KEY = "password";
|
public static final String PASSWORD_PROPERTY_KEY = "password";
|
||||||
public static final String CLIENT_ID_PROPERTY_KEY = "clientId";
|
public static final String CLIENT_ID_PROPERTY_KEY = "clientId";
|
||||||
|
|
||||||
|
public static final String RESOURCE_REGISTRY_URL_PROPERTY = "RESOURCE_REGISTRY_URL";
|
||||||
|
|
||||||
static {
|
static {
|
||||||
GCUBE = "/gcube";
|
GCUBE = "/gcube";
|
||||||
DEVNEXT = GCUBE + "/devNext";
|
DEVNEXT = GCUBE + "/devNext";
|
||||||
|
@ -54,7 +56,7 @@ public class ContextTest {
|
||||||
DEVSEC = GCUBE + "/devsec";
|
DEVSEC = GCUBE + "/devsec";
|
||||||
DEVVRE = DEVSEC + "/devVRE";
|
DEVVRE = DEVSEC + "/devVRE";
|
||||||
|
|
||||||
PARENT_DEFAULT_TEST_SCOPE = "/gcube";
|
PARENT_DEFAULT_TEST_SCOPE = GCUBE;
|
||||||
DEFAULT_TEST_SCOPE = DEVNEXT;
|
DEFAULT_TEST_SCOPE = DEVNEXT;
|
||||||
ALTERNATIVE_TEST_SCOPE = NEXTNEXT;
|
ALTERNATIVE_TEST_SCOPE = NEXTNEXT;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"type": "ConsistsOf",
|
||||||
|
"source": {
|
||||||
|
"type": "HostingNode",
|
||||||
|
"id": "34498fb5-e184-473b-ad2f-08f7ab1afd35"
|
||||||
|
},
|
||||||
|
"target": {
|
||||||
|
"type" : "CPUFacet"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue