Skip to content

Commit

Permalink
tiny fix
Browse files Browse the repository at this point in the history
Change-Id: Ie49d8ec724af21aa38769ed924e9116d31467832
  • Loading branch information
javeme committed Feb 23, 2021
1 parent aa43d99 commit efd8753
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,8 @@ public static String roleFor(String owner, HugePermission perm) {
* Construct required permission such as:
* $owner=graph1 $action=read
* (means required read permission of any one resource)
* maybe also support:
*
* In the future maybe also support:
* $owner=graph1 $action=vertex_read
*/
return String.format("%s=%s %s=%s", KEY_OWNER, owner,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@

public class HugeAccess extends Relationship {

private static final long serialVersionUID = -7644007602408729385L;

private final Id group;
private final Id target;
private HugePermission permission;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@
import org.apache.tinkerpop.gremlin.structure.T;

import com.baidu.hugegraph.HugeGraphParams;
import com.baidu.hugegraph.auth.ResourceType;
import com.baidu.hugegraph.auth.SchemaDefine.Relationship;
import com.baidu.hugegraph.backend.id.Id;
import com.baidu.hugegraph.schema.EdgeLabel;

public class HugeBelong extends Relationship {

private static final long serialVersionUID = -7242751631755533423L;

private final Id user;
private final Id group;
private String description;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,15 @@
import org.apache.tinkerpop.gremlin.structure.Vertex;

import com.baidu.hugegraph.HugeGraphParams;
import com.baidu.hugegraph.auth.ResourceType;
import com.baidu.hugegraph.auth.SchemaDefine.Entity;
import com.baidu.hugegraph.backend.id.Id;
import com.baidu.hugegraph.schema.VertexLabel;
import com.baidu.hugegraph.util.E;

public class HugeGroup extends Entity {

private static final long serialVersionUID = 2330399818352242686L;

private String name;
private String description;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

import com.baidu.hugegraph.HugeException;
import com.baidu.hugegraph.HugeGraphParams;
import com.baidu.hugegraph.auth.ResourceType;
import com.baidu.hugegraph.auth.SchemaDefine.Entity;
import com.baidu.hugegraph.backend.id.Id;
import com.baidu.hugegraph.schema.VertexLabel;
Expand All @@ -41,6 +40,8 @@

public class HugeTarget extends Entity {

private static final long serialVersionUID = -3361487778656878418L;

private String name;
private String graph;
private String url;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@

public class HugeUser extends Entity {

private static final long serialVersionUID = -8951193710873772717L;

private String name;
private String password;
private String phone;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ protected static String unhideField(String label, String key) {

public static abstract class UserElement implements Serializable {

private static final long serialVersionUID = 8746691160192814973L;

protected static final String CREATE = "create";
protected static final String UPDATE = "update";
protected static final String CREATOR = "creator";
Expand Down Expand Up @@ -241,6 +243,8 @@ protected Object[] asArray(List<Object> list) {
public static abstract class Entity extends UserElement
implements com.baidu.hugegraph.type.Namifiable {

private static final long serialVersionUID = 4113319546914811762L;

public static <T extends Entity> T fromVertex(Vertex vertex, T entity) {
E.checkArgument(vertex.label().equals(entity.label()),
"Illegal vertex label '%s' for entity '%s'",
Expand All @@ -267,6 +271,8 @@ public String idString() {

public static abstract class Relationship extends UserElement {

private static final long serialVersionUID = -1406157381685832493L;

public abstract String sourceLabel();
public abstract String targetLabel();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,12 @@ public void testResourceType() {
Assert.assertTrue(ResourceType.ROOT.match(ResourceType.EDGE));
Assert.assertTrue(ResourceType.ROOT.match(ResourceType.VERTEX_LABEL));
Assert.assertTrue(ResourceType.ROOT.match(ResourceType.META));
Assert.assertTrue(ResourceType.ALL.match(ResourceType.ALL));;
Assert.assertTrue(ResourceType.ROOT.match(ResourceType.ALL));
Assert.assertTrue(ResourceType.ROOT.match(ResourceType.GRANT));
Assert.assertTrue(ResourceType.ROOT.match(ResourceType.USER_GROUP));
Assert.assertTrue(ResourceType.ROOT.match(ResourceType.TARGET));
Assert.assertTrue(ResourceType.ROOT.match(ResourceType.METRICS));
Assert.assertFalse(ResourceType.ALL.match(ResourceType.ROOT));
Assert.assertFalse(ResourceType.ROOT.match(ResourceType.ROOT));

// ALL
Assert.assertTrue(ResourceType.ALL.match(ResourceType.NONE));
Expand Down

0 comments on commit efd8753

Please sign in to comment.