shaofengshi closed pull request #235: KYLIN-3531 Save uppercase of usernames to 
metadata
URL: https://github.com/apache/kylin/pull/235
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/server-base/src/main/java/org/apache/kylin/rest/security/KylinUserManager.java
 
b/server-base/src/main/java/org/apache/kylin/rest/security/KylinUserManager.java
index c4b457de53..acbc0084c2 100644
--- 
a/server-base/src/main/java/org/apache/kylin/rest/security/KylinUserManager.java
+++ 
b/server-base/src/main/java/org/apache/kylin/rest/security/KylinUserManager.java
@@ -25,6 +25,7 @@
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
+import java.util.Locale;
 
 import org.apache.kylin.common.KylinConfig;
 import org.apache.kylin.common.persistence.ResourceStore;
@@ -119,6 +120,7 @@ public void update(ManagedUser user) {
             if (exist != null) {
                 user.setLastModified(exist.getLastModified());
             }
+            user.setUsername(user.getUsername().toUpperCase(Locale.ROOT));
             crud.save(user);
         } catch (IOException e) {
             throw new RuntimeException("Can not update user.", e);
@@ -127,7 +129,7 @@ public void update(ManagedUser user) {
 
     public void delete(String username) {
         try (AutoReadWriteLock.AutoLock l = lock.lockForWrite()) {
-            crud.delete(username);
+            crud.delete(username.toUpperCase(Locale.ROOT));
         } catch (IOException e) {
             throw new RuntimeException("Can not delete user.", e);
         }
diff --git 
a/server-base/src/main/java/org/apache/kylin/rest/service/KylinUserService.java 
b/server-base/src/main/java/org/apache/kylin/rest/service/KylinUserService.java
index 8571aec9e7..eea8cd7096 100644
--- 
a/server-base/src/main/java/org/apache/kylin/rest/service/KylinUserService.java
+++ 
b/server-base/src/main/java/org/apache/kylin/rest/service/KylinUserService.java
@@ -90,7 +90,7 @@ public void updateUser(UserDetails user) {
 
     @Override
     public void deleteUser(String userName) {
-        if (userName.equals(SUPER_ADMIN)) {
+        if (userName.equalsIgnoreCase(SUPER_ADMIN)) {
             throw new InternalErrorException("User " + userName + " is not 
allowed to be deleted.");
         }
 


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to