This repository was archived by the owner on Dec 23, 2017. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
src/main/java/org/graylog/plugins/usagestatistics Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 3535import javax .ws .rs .Produces ;
3636import javax .ws .rs .core .MediaType ;
3737
38+ import static org .graylog2 .shared .security .RestPermissions .CLUSTER_CONFIG_ENTRY_CREATE ;
39+ import static org .graylog2 .shared .security .RestPermissions .CLUSTER_CONFIG_ENTRY_READ ;
40+
3841@ RequiresAuthentication
3942@ Api (value = "Usage Statistics Opt-Out" , description = "Anonymous usage statistics opt-out state of this Graylog setup" )
4043@ Path ("/opt-out" )
4144public class UsageStatsOptOutResource extends RestResource implements PluginRestResource {
45+ private static final String CLUSTER_CONFIG_INSTANCE = UsageStatsOptOutState .class .getCanonicalName ();
46+
4247 private final UsageStatsOptOutService usageStatsOptOutService ;
4348
4449 @ Inject
@@ -54,6 +59,8 @@ public UsageStatsOptOutResource(UsageStatsOptOutService usageStatsOptOutService)
5459 @ ApiResponse (code = 500 , message = "Internal Server Error" )
5560 })
5661 public UsageStatsOptOutState getOptOutState () {
62+ checkPermission (CLUSTER_CONFIG_ENTRY_READ , CLUSTER_CONFIG_INSTANCE );
63+
5764 final UsageStatsOptOutState optOutState = usageStatsOptOutService .getOptOutState ();
5865
5966 if (optOutState == null ) {
@@ -73,6 +80,8 @@ public UsageStatsOptOutState getOptOutState() {
7380 @ ApiResponse (code = 500 , message = "Internal Server Error" )
7481 })
7582 public void setOptOutState (@ Valid @ NotNull UsageStatsOptOutState optOutState ) {
83+ checkPermission (CLUSTER_CONFIG_ENTRY_CREATE , CLUSTER_CONFIG_INSTANCE );
84+
7685 usageStatsOptOutService .setOptOutState (optOutState );
7786 }
7887}
You can’t perform that action at this time.
0 commit comments