Skip to content

Commit

Permalink
Optimize and update some code
Browse files Browse the repository at this point in the history
  • Loading branch information
xuliguov5 committed Feb 9, 2021
1 parent 7fdbbd5 commit c354121
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public String system() {
@Timed
@Path("backend")
@Produces(APPLICATION_JSON_WITH_CHARSET)
@RolesAllowed({"admin", "$owner= $action=metrics_read"})
// @RolesAllowed({"admin", "$owner= $action=metrics_read"})
public String backend(@Context GraphManager manager) {
Map<String, Map<String, Object>> results = InsertionOrderUtil.newMap();
for (String graph : manager.graphs()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ public final class HugeGraphAuthProxy implements HugeGraph {
private static final Logger LOG = Log.logger(HugeGraphAuthProxy.class);

private final HugeGraph hugegraph;
private final TaskScheduler taskScheduler;
private final UserManager userManager;
private final TaskSchedulerProxy taskScheduler;
private final UserManagerProxy userManager;

public HugeGraphAuthProxy(HugeGraph hugegraph) {
LOG.info("Wrap graph '{}' with HugeGraphAuthProxy", hugegraph.name());
Expand Down Expand Up @@ -655,7 +655,7 @@ public UserManager userManager() {
@Override
public void swichUserManager(UserManager userManager) {
this.verifyAdminPermission();
this.hugegraph.swichUserManager(userManager);
this.userManager.swichUserManager(userManager);
}

@Override
Expand Down Expand Up @@ -1050,7 +1050,7 @@ private boolean hasTaskPermission(HugeTask<?> task) {

class UserManagerProxy implements UserManager {

private final UserManager userManager;
private UserManager userManager;

public UserManagerProxy(UserManager origin) {
this.userManager = origin;
Expand Down Expand Up @@ -1351,6 +1351,11 @@ public RolePermission loginUser(String username, String password) {
setContext(context);
}
}

private void swichUserManager(UserManager userManager) {
this.userManager = userManager;
hugegraph.swichUserManager(userManager);
}
}

class VariablesProxy implements Variables {
Expand Down

0 comments on commit c354121

Please sign in to comment.