You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by js...@apache.org on 2016/11/24 12:37:30 UTC
svn commit: r1771122 -
/sling/trunk/bundles/jcr/base/src/main/java/org/apache/sling/jcr/base/AbstractSlingRepositoryManager.java
Author: jsedding
Date: Thu Nov 24 12:37:30 2016
New Revision: 1771122
URL: http://svn.apache.org/viewvc?rev=1771122&view=rev
Log:
SLING-6285 - Implement LoginAdminWhitelist in JCR Base
- improve comment for isAllowLoginAdministrativeForBundleOverridden
- slightly simplify boolean expression
Modified:
sling/trunk/bundles/jcr/base/src/main/java/org/apache/sling/jcr/base/AbstractSlingRepositoryManager.java
Modified: sling/trunk/bundles/jcr/base/src/main/java/org/apache/sling/jcr/base/AbstractSlingRepositoryManager.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/base/src/main/java/org/apache/sling/jcr/base/AbstractSlingRepositoryManager.java?rev=1771122&r1=1771121&r2=1771122&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/base/src/main/java/org/apache/sling/jcr/base/AbstractSlingRepositoryManager.java (original)
+++ sling/trunk/bundles/jcr/base/src/main/java/org/apache/sling/jcr/base/AbstractSlingRepositoryManager.java Thu Nov 24 12:37:30 2016
@@ -497,14 +497,20 @@ public abstract class AbstractSlingRepos
}
// find out whether allowLoginAdministrativeForBundle is overridden
+ // by iterating through the super classes of the implementation
+ // class and search for the class which defines the method
+ // "allowLoginAdministrativeForBundle". If we don't find
+ // the method before hitting AbstractSlingRepositoryManager
+ // we know that our implementation is inherited.
+ // Note: clazz.get(Declared)Method(name, parameterTypes).getDeclaringClass()
+ // does not yield the same results and is therefore no fitting substitute.
private boolean isAllowLoginAdministrativeForBundleOverridden() {
Class<?> clazz = getClass();
while (clazz != AbstractSlingRepositoryManager.class) {
final Method[] declaredMethods = clazz.getDeclaredMethods();
for (final Method method : declaredMethods) {
if (method.getName().equals("allowLoginAdministrativeForBundle")
- && method.getParameterTypes().length == 1
- && method.getParameterTypes()[0] == Bundle.class) {
+ && Arrays.equals(method.getParameterTypes(), new Class<?>[]{Bundle.class})) {
return true;
}
}