|
57 | 57 | import org.opensearch.security.dlic.rest.validation.AbstractConfigurationValidator.ErrorType; |
58 | 58 | import org.opensearch.security.privileges.PrivilegesEvaluator; |
59 | 59 | import org.opensearch.security.securityconf.DynamicConfigFactory; |
60 | | -import org.opensearch.security.securityconf.Hideable; |
61 | | -import org.opensearch.security.securityconf.StaticDefinable; |
62 | 60 | import org.opensearch.security.securityconf.impl.CType; |
63 | 61 | import org.opensearch.security.securityconf.impl.SecurityDynamicConfiguration; |
64 | 62 | import org.opensearch.security.ssl.transport.PrincipalExtractor; |
@@ -588,23 +586,13 @@ protected void notImplemented(RestChannel channel, Method method) { |
588 | 586 | } |
589 | 587 |
|
590 | 588 | protected final boolean isReserved(SecurityDynamicConfiguration<?> configuration, String resourceName) { |
591 | | - if (isStatic(configuration, resourceName)) { // static is also always reserved |
592 | | - return true; |
593 | | - } |
594 | | - |
595 | | - final Object o = configuration.getCEntry(resourceName); |
596 | | - return o != null && o instanceof Hideable && ((Hideable) o).isReserved(); |
| 589 | + return configuration.isStatic(resourceName) || configuration.isReserved(resourceName); |
597 | 590 | } |
598 | 591 |
|
599 | 592 | protected final boolean isHidden(SecurityDynamicConfiguration<?> configuration, String resourceName) { |
600 | 593 | return configuration.isHidden(resourceName) && !isSuperAdmin(); |
601 | 594 | } |
602 | 595 |
|
603 | | - protected final boolean isStatic(SecurityDynamicConfiguration<?> configuration, String resourceName) { |
604 | | - final Object o = configuration.getCEntry(resourceName); |
605 | | - return o != null && o instanceof StaticDefinable && ((StaticDefinable) o).isStatic(); |
606 | | - } |
607 | | - |
608 | 596 | /** |
609 | 597 | * Consume all defined parameters for the request. Before we handle the |
610 | 598 | * request in subclasses where we actually need the parameter, some global |
@@ -636,7 +624,7 @@ protected boolean isSuperAdmin() { |
636 | 624 | * @return True if resource readonly |
637 | 625 | */ |
638 | 626 | protected boolean isReadOnly(final SecurityDynamicConfiguration<?> existingConfiguration, String name) { |
639 | | - return isSuperAdmin() ? false : isReserved(existingConfiguration, name); |
| 627 | + return !isSuperAdmin() && isReserved(existingConfiguration, name); |
640 | 628 | } |
641 | 629 |
|
642 | 630 | /** |
|
0 commit comments