Skip to content

Commit d128425

Browse files
committed
Fixes
Signed-off-by: Nils Bandener <[email protected]>
1 parent dbf7cd6 commit d128425

File tree

2 files changed

+8
-19
lines changed

2 files changed

+8
-19
lines changed

src/main/java/org/opensearch/security/privileges/PrivilegesEvaluator.java

+8-6
Original file line numberDiff line numberDiff line change
@@ -199,13 +199,15 @@ public PrivilegesEvaluator(
199199
SecurityDynamicConfiguration<?> rolesConfiguration = configurationRepository.getConfiguration(CType.ROLES);
200200

201201
if (rolesConfiguration != null) {
202-
FlattenedActionGroups flattenedActionGroups = actionGroupsConfiguration != null
203-
? new FlattenedActionGroups(
204-
(SecurityDynamicConfiguration<ActionGroupsV7>) DynamicConfigFactory.addStatics(
205-
actionGroupsConfiguration.deepClone()
206-
)
202+
@SuppressWarnings("unchecked")
203+
SecurityDynamicConfiguration<ActionGroupsV7> actionGroupsWithStatics = actionGroupsConfiguration != null
204+
? (SecurityDynamicConfiguration<ActionGroupsV7>) DynamicConfigFactory.addStatics(
205+
actionGroupsConfiguration.deepClone()
207206
)
208-
: FlattenedActionGroups.EMPTY;
207+
: (SecurityDynamicConfiguration<ActionGroupsV7>) DynamicConfigFactory.addStatics(
208+
SecurityDynamicConfiguration.empty()
209+
);
210+
FlattenedActionGroups flattenedActionGroups = new FlattenedActionGroups(actionGroupsWithStatics);
209211
ActionPrivileges actionPrivileges = new ActionPrivileges(
210212
DynamicConfigFactory.addStatics(rolesConfiguration.deepClone()),
211213
flattenedActionGroups,

src/main/java/org/opensearch/security/securityconf/impl/SecurityDynamicConfiguration.java

-13
Original file line numberDiff line numberDiff line change
@@ -172,19 +172,6 @@ public static <T> SecurityDynamicConfiguration<T> fromYaml(String yaml, CType ct
172172
return result;
173173
}
174174

175-
/**
176-
* For testing only
177-
*/
178-
public static <T> SecurityDynamicConfiguration<T> fromMap(Map<String, Object> map, CType ctype) throws JsonProcessingException {
179-
Class<?> implementationClass = ctype.getImplementationClass().get(2);
180-
SecurityDynamicConfiguration<T> result = DefaultObjectMapper.objectMapper.convertValue(
181-
map,
182-
DefaultObjectMapper.getTypeFactory().constructParametricType(SecurityDynamicConfiguration.class, implementationClass)
183-
);
184-
result.ctype = ctype;
185-
return result;
186-
}
187-
188175
// for Jackson
189176
private SecurityDynamicConfiguration() {
190177
super();

0 commit comments

Comments
 (0)