@@ -118,7 +118,8 @@ protected MasterClientServiceHandler(Master master) {
118
118
public long initiateFlush (TInfo tinfo , TCredentials c , String tableId )
119
119
throws ThriftSecurityException , ThriftTableOperationException {
120
120
String namespaceId = getNamespaceIdFromTableId (TableOperation .FLUSH , tableId );
121
- master .security .canFlush (c , tableId , namespaceId );
121
+ if (!master .security .canFlush (c , tableId , namespaceId ))
122
+ throw new ThriftSecurityException (c .getPrincipal (), SecurityErrorCode .PERMISSION_DENIED );
122
123
123
124
String zTablePath = Constants .ZROOT + "/" + master .getInstance ().getInstanceID ()
124
125
+ Constants .ZTABLES + "/" + tableId + Constants .ZTABLE_FLUSH_ID ;
@@ -150,7 +151,8 @@ public void waitForFlush(TInfo tinfo, TCredentials c, String tableId, ByteBuffer
150
151
ByteBuffer endRow , long flushID , long maxLoops )
151
152
throws ThriftSecurityException , ThriftTableOperationException {
152
153
String namespaceId = getNamespaceIdFromTableId (TableOperation .FLUSH , tableId );
153
- master .security .canFlush (c , tableId , namespaceId );
154
+ if (!master .security .canFlush (c , tableId , namespaceId ))
155
+ throw new ThriftSecurityException (c .getPrincipal (), SecurityErrorCode .PERMISSION_DENIED );
154
156
155
157
if (endRow != null && startRow != null
156
158
&& ByteBufferUtil .toText (startRow ).compareTo (ByteBufferUtil .toText (endRow )) >= 0 )
@@ -305,7 +307,8 @@ public void setTableProperty(TInfo info, TCredentials credentials, String tableN
305
307
@ Override
306
308
public void shutdown (TInfo info , TCredentials c , boolean stopTabletServers )
307
309
throws ThriftSecurityException {
308
- master .security .canPerformSystemActions (c );
310
+ if (!master .security .canPerformSystemActions (c ))
311
+ throw new ThriftSecurityException (c .getPrincipal (), SecurityErrorCode .PERMISSION_DENIED );
309
312
if (stopTabletServers ) {
310
313
master .setMasterGoalState (MasterGoalState .CLEAN_STOP );
311
314
EventCoordinator .Listener eventListener = master .nextEvent .getListener ();
@@ -319,7 +322,8 @@ public void shutdown(TInfo info, TCredentials c, boolean stopTabletServers)
319
322
@ Override
320
323
public void shutdownTabletServer (TInfo info , TCredentials c , String tabletServer , boolean force )
321
324
throws ThriftSecurityException {
322
- master .security .canPerformSystemActions (c );
325
+ if (!master .security .canPerformSystemActions (c ))
326
+ throw new ThriftSecurityException (c .getPrincipal (), SecurityErrorCode .PERMISSION_DENIED );
323
327
324
328
final TServerInstance doomed = master .tserverSet .find (tabletServer );
325
329
if (!force ) {
@@ -391,15 +395,17 @@ public void reportTabletStatus(TInfo info, TCredentials credentials, String serv
391
395
@ Override
392
396
public void setMasterGoalState (TInfo info , TCredentials c , MasterGoalState state )
393
397
throws ThriftSecurityException {
394
- master .security .canPerformSystemActions (c );
398
+ if (!master .security .canPerformSystemActions (c ))
399
+ throw new ThriftSecurityException (c .getPrincipal (), SecurityErrorCode .PERMISSION_DENIED );
395
400
396
401
master .setMasterGoalState (state );
397
402
}
398
403
399
404
@ Override
400
405
public void removeSystemProperty (TInfo info , TCredentials c , String property )
401
406
throws ThriftSecurityException {
402
- master .security .canPerformSystemActions (c );
407
+ if (!master .security .canPerformSystemActions (c ))
408
+ throw new ThriftSecurityException (c .getPrincipal (), SecurityErrorCode .PERMISSION_DENIED );
403
409
404
410
try {
405
411
SystemPropUtil .removeSystemProperty (property );
@@ -413,7 +419,8 @@ public void removeSystemProperty(TInfo info, TCredentials c, String property)
413
419
@ Override
414
420
public void setSystemProperty (TInfo info , TCredentials c , String property , String value )
415
421
throws ThriftSecurityException , TException {
416
- master .security .canPerformSystemActions (c );
422
+ if (!master .security .canPerformSystemActions (c ))
423
+ throw new ThriftSecurityException (c .getPrincipal (), SecurityErrorCode .PERMISSION_DENIED );
417
424
418
425
try {
419
426
SystemPropUtil .setSystemProperty (property , value );
0 commit comments