nichunen commented on a change in pull request #790: KYLIN-4122 Add kylin user
and group manage modules
URL: https://github.com/apache/kylin/pull/790#discussion_r312926639
##########
File path:
server-base/src/main/java/org/apache/kylin/rest/controller/UserController.java
##########
@@ -72,4 +126,260 @@ public UserDetails authenticatedUser() {
return null;
}
+
+ @PostConstruct
+ public void init() throws IOException {
+ passwordPattern =
Pattern.compile("^(?=.*\\d)(?=.*[a-zA-Z])(?=.*[~!@#$%^&*(){}|:\"<>?\\[\\];',./`]).{8,}$");
+ bcryptPattern =
Pattern.compile("\\A\\$2a?\\$\\d\\d\\$[./0-9A-Za-z]{53}");
+ pwdEncoder = new BCryptPasswordEncoder();
+
+ List<ManagedUser> all = userService.listUsers();
+ logger.info("All {} users", all.size());
+ if (all.isEmpty() &&
("testing".equals(System.getProperty(ACTIVE_PROFILES_NAME))
+ || "custom".equals(System.getProperty(ACTIVE_PROFILES_NAME))))
{
+ create(ADMIN, new ManagedUser(ADMIN, ADMIN_DEFAULT, true,
Constant.ROLE_ADMIN, Constant.GROUP_ALL_USERS));
+ create(ANALYST, new ManagedUser(ANALYST, ANALYST, true,
Constant.GROUP_ALL_USERS));
+ create(MODELER, new ManagedUser(MODELER, MODELER, true,
Constant.GROUP_ALL_USERS));
+ }
+
+ }
+
+ public UserDetails loadUserByUsername(String username) {
+ return get(username);
+ }
+
+ private void checkProfileEditAllowed() {
+ String activeProfiles = System.getProperty(ACTIVE_PROFILES_NAME);
+ if (!"testing".equals(activeProfiles) &&
!"custom".equals(activeProfiles)) {
+ throw new BadRequestException("Action not allowed!");
+ }
+ }
+
+ @RequestMapping(value = "/{userName:.+}", method = { RequestMethod.POST },
produces = { "application/json" })
+ @ResponseBody
+ @PreAuthorize(Constant.ACCESS_HAS_ROLE_ADMIN)
+ //do not use aclEvaluate, if thgetManagedUsersByFuzzMatchingere's no users
and will come into init() and will call save.
Review comment:
thgetManagedUsersByFuzzMatchingere?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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