Introduce StreamEvents capability

This change introduces new global capability for streaming
Gerrit events.

Only admins and users with this capability are able to run
gerrit stream-events.

Change-Id: I0a8a110758b0ac43969e5b8ae799b9b89db318e2
Signed-off-by: Ed Bartosh <bartosh@gmail.com>
Signed-off-by: Alexander Kanevskiy <kad@blackcatlinux.com>
This commit is contained in:
Ed Bartosh
2013-04-13 20:15:58 +03:00
committed by Alexander D. Kanevskiy
parent 72b714137b
commit d168b81bbb
7 changed files with 29 additions and 1 deletions

View File

@@ -142,6 +142,12 @@ public class CapabilityControl {
|| canAdministrateServer();
}
/** @return true if the user can stream Gerrit events. */
public boolean canStreamEvents() {
return canPerform(GlobalCapability.STREAM_EVENTS)
|| canAdministrateServer();
}
/** @return true if the user can run the Git garbage collection. */
public boolean canRunGC() {
return canPerform(GlobalCapability.RUN_GC)

View File

@@ -24,6 +24,7 @@ import static com.google.gerrit.common.data.GlobalCapability.KILL_TASK;
import static com.google.gerrit.common.data.GlobalCapability.PRIORITY;
import static com.google.gerrit.common.data.GlobalCapability.RUN_GC;
import static com.google.gerrit.common.data.GlobalCapability.START_REPLICATION;
import static com.google.gerrit.common.data.GlobalCapability.STREAM_EVENTS;
import static com.google.gerrit.common.data.GlobalCapability.VIEW_CACHES;
import static com.google.gerrit.common.data.GlobalCapability.VIEW_CONNECTIONS;
import static com.google.gerrit.common.data.GlobalCapability.VIEW_QUEUE;
@@ -104,6 +105,7 @@ class GetCapabilities implements RestReadView<AccountResource> {
have.put(VIEW_QUEUE, cc.canViewQueue());
have.put(RUN_GC, cc.canRunGC());
have.put(START_REPLICATION, cc.canStartReplication());
have.put(STREAM_EVENTS, cc.canStreamEvents());
have.put(ACCESS_DATABASE, cc.canAccessDatabase());
QueueProvider.QueueType queue = cc.getQueueType();