Skip to content

Commit

Permalink
Return meaningful values for MessageTask getMethodName function[API-2…
Browse files Browse the repository at this point in the history
…037] (hazelcast#25020)

Return meaningful values for MessageTask `getMethodName` function. Added
non-null method names to some of the message tasks which were missing
the names and can be used in security interceptor since they are related
to the user method calls.

The ones which return null for the `getMethodName` function are the
internally used or not directly related to the user API calls.

Also, removed the default null returning implementations in some of the
base message tasks.

The changes at the method names should be mentioned at the Release Notes. !!!

EE PR: hazelcast/hazelcast-enterprise#6252
  • Loading branch information
ihsandemir authored and JackPGreen committed Oct 17, 2023
1 parent 64d00fa commit fdfb545
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package com.hazelcast.client.impl.protocol.task.cache;

import com.hazelcast.cache.CacheUtil;
import com.hazelcast.cache.impl.CacheService;
import com.hazelcast.cache.impl.ICacheService;
import com.hazelcast.cache.impl.PreJoinCacheConfig;
Expand All @@ -27,8 +26,7 @@
import com.hazelcast.config.CacheConfig;
import com.hazelcast.instance.impl.Node;
import com.hazelcast.internal.nio.Connection;
import com.hazelcast.security.permission.ActionConstants;
import com.hazelcast.security.permission.CachePermission;
import com.hazelcast.security.permission.ConfigPermission;
import com.hazelcast.security.SecurityInterceptorConstants;
import com.hazelcast.spi.impl.InternalCompletableFuture;
import com.hazelcast.spi.merge.SplitBrainMergePolicyProvider;
Expand Down Expand Up @@ -84,8 +82,7 @@ public String getServiceName() {

@Override
public Permission getRequiredPermission() {
CacheConfig cacheConfig = parameters.cacheConfig.asCacheConfig(serializationService);
return new CachePermission(CacheUtil.getDistributedObjectName(cacheConfig.getName()), ActionConstants.ACTION_CREATE);
return new ConfigPermission();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public Object[] getParameters() {

@Override
public String getMethodName() {
return SecurityInterceptorConstants.REMOVE_ALL;
return SecurityInterceptorConstants.REMOVE_ALL_KEYS;
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public Permission getRequiredPermission() {

@Override
public String getMethodName() {
return SecurityInterceptorConstants.ITERATOR;
return SecurityInterceptorConstants.GET_ALL;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public final class SecurityInterceptorConstants {
public static final String PUT = "put";
public static final String GET_AND_PUT = "getAndPut";
public static final String REMOVE = "remove";
public static final String REMOVE_ALL_KEYS = "removeAllKeys";
public static final String REMOVE_ALL = "removeAll";
public static final String REPLACE = "replace";
public static final String SET_EXPIRY_POLICY = "setExpiryPolicy";
Expand Down

0 comments on commit fdfb545

Please sign in to comment.