Merge "Remove user-rescoping from PermissionBackend"
This commit is contained in:
commit
eaf50c152b
@ -260,16 +260,6 @@ class ChangeControl {
|
||||
return cd;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForChange user(CurrentUser user) {
|
||||
return forUser(user).asForChange(cd, db);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForChange absentUser(Account.Id id) {
|
||||
return user(identifiedUserFactory.create(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resourcePath() {
|
||||
if (resourcePath == null) {
|
||||
|
@ -16,10 +16,8 @@ package com.google.gerrit.server.permissions;
|
||||
|
||||
import com.google.gerrit.extensions.api.access.GlobalOrPluginPermission;
|
||||
import com.google.gerrit.extensions.conditions.BooleanCondition;
|
||||
import com.google.gerrit.reviewdb.client.Account;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||
import com.google.gerrit.server.CurrentUser;
|
||||
import com.google.gerrit.server.notedb.ChangeNotes;
|
||||
import com.google.gerrit.server.permissions.PermissionBackend.ForChange;
|
||||
import com.google.gerrit.server.permissions.PermissionBackend.ForProject;
|
||||
@ -121,16 +119,6 @@ public class FailedPermissionBackend {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForProject user(CurrentUser user) {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForProject absentUser(Account.Id id) {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resourcePath() {
|
||||
throw new UnsupportedOperationException(
|
||||
@ -180,16 +168,6 @@ public class FailedPermissionBackend {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForRef user(CurrentUser user) {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForRef absentUser(Account.Id id) {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resourcePath() {
|
||||
throw new UnsupportedOperationException(
|
||||
@ -243,16 +221,6 @@ public class FailedPermissionBackend {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForChange user(CurrentUser user) {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForChange absentUser(Account.Id id) {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resourcePath() {
|
||||
throw new UnsupportedOperationException(
|
||||
|
@ -294,12 +294,6 @@ public abstract class PermissionBackend {
|
||||
/** Returns the fully qualified resource path that this instance is scoped to. */
|
||||
public abstract String resourcePath();
|
||||
|
||||
/** Returns a new instance rescoped to same project, but different {@code user}. */
|
||||
public abstract ForProject user(CurrentUser user);
|
||||
|
||||
/** @see PermissionBackend#absentUser(Account.Id) */
|
||||
public abstract ForProject absentUser(Account.Id id);
|
||||
|
||||
/** Returns an instance scoped for {@code ref} in this project. */
|
||||
public abstract ForRef ref(String ref);
|
||||
|
||||
@ -400,12 +394,6 @@ public abstract class PermissionBackend {
|
||||
/** Returns a fully qualified resource path that this instance is scoped to. */
|
||||
public abstract String resourcePath();
|
||||
|
||||
/** Returns a new instance rescoped to same reference, but different {@code user}. */
|
||||
public abstract ForRef user(CurrentUser user);
|
||||
|
||||
/** @see PermissionBackend#absentUser(Account.Id) */
|
||||
public abstract ForRef absentUser(Account.Id id);
|
||||
|
||||
/** Returns an instance scoped to change. */
|
||||
public abstract ForChange change(ChangeData cd);
|
||||
|
||||
@ -456,12 +444,6 @@ public abstract class PermissionBackend {
|
||||
/** Returns the fully qualified resource path that this instance is scoped to. */
|
||||
public abstract String resourcePath();
|
||||
|
||||
/** Returns a new instance rescoped to same change, but different {@code user}. */
|
||||
public abstract ForChange user(CurrentUser user);
|
||||
|
||||
/** @see PermissionBackend#absentUser(Account.Id) */
|
||||
public abstract ForChange absentUser(Account.Id id);
|
||||
|
||||
/** Verify scoped user can {@code perm}, throwing if denied. */
|
||||
public abstract void check(ChangePermissionOrLabel perm)
|
||||
throws AuthException, PermissionBackendException;
|
||||
|
@ -21,7 +21,6 @@ import com.google.gerrit.common.data.Permission;
|
||||
import com.google.gerrit.common.data.PermissionRule;
|
||||
import com.google.gerrit.extensions.conditions.BooleanCondition;
|
||||
import com.google.gerrit.extensions.restapi.AuthException;
|
||||
import com.google.gerrit.reviewdb.client.Account;
|
||||
import com.google.gerrit.reviewdb.client.AccountGroup;
|
||||
import com.google.gerrit.reviewdb.client.Branch;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
@ -323,16 +322,6 @@ class ProjectControl {
|
||||
private DefaultRefFilter refFilter;
|
||||
private String resourcePath;
|
||||
|
||||
@Override
|
||||
public ForProject user(CurrentUser user) {
|
||||
return forUser(user).asForProject().database(db);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForProject absentUser(Account.Id id) {
|
||||
return user(identifiedUserFactory.create(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resourcePath() {
|
||||
if (resourcePath == null) {
|
||||
|
@ -22,7 +22,6 @@ import com.google.gerrit.common.data.PermissionRule;
|
||||
import com.google.gerrit.common.data.PermissionRule.Action;
|
||||
import com.google.gerrit.extensions.conditions.BooleanCondition;
|
||||
import com.google.gerrit.extensions.restapi.AuthException;
|
||||
import com.google.gerrit.reviewdb.client.Account;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
import com.google.gerrit.reviewdb.client.RefNames;
|
||||
@ -408,16 +407,6 @@ class RefControl {
|
||||
private class ForRefImpl extends ForRef {
|
||||
private String resourcePath;
|
||||
|
||||
@Override
|
||||
public ForRef user(CurrentUser user) {
|
||||
return forUser(user).asForRef().database(db);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForRef absentUser(Account.Id id) {
|
||||
return user(identifiedUserFactory.create(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resourcePath() {
|
||||
if (resourcePath == null) {
|
||||
|
@ -48,16 +48,6 @@ public class UiActionsTest {
|
||||
return "/projects/test-project";
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForProject user(CurrentUser user) {
|
||||
throw new UnsupportedOperationException("not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForProject absentUser(Account.Id id) {
|
||||
throw new UnsupportedOperationException("not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForRef ref(String ref) {
|
||||
throw new UnsupportedOperationException("not implemented");
|
||||
|
Loading…
Reference in New Issue
Block a user