| | |
| | | * @return true if the user service supports credential changes |
| | | */ |
| | | public boolean supportsCredentialChanges(UserModel user) { |
| | | return (user != null && user.isLocalAccount()) || userService.supportsCredentialChanges(); |
| | | if (user == null) { |
| | | return false; |
| | | } else if (!Constants.EXTERNAL_ACCOUNT.equals(user.password)) { |
| | | // credentials likely maintained by Gitblit |
| | | return userService.supportsCredentialChanges(); |
| | | } else { |
| | | // credentials are externally maintained |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | Principal principal = httpRequest.getUserPrincipal(); |
| | | if (principal != null) { |
| | | String username = principal.getName(); |
| | | if (StringUtils.isEmpty(username)) { |
| | | if (!StringUtils.isEmpty(username)) { |
| | | UserModel user = getUserModel(username); |
| | | if (user != null) { |
| | | // existing user |
| | | flagWicketSession(AuthenticationType.CONTAINER); |
| | | logger.debug(MessageFormat.format("{0} authenticated by servlet container principal from {1}", |
| | | user.username, httpRequest.getRemoteAddr())); |
| | | return user; |
| | | } else if (settings.getBoolean(Keys.realm.container.autoCreateAccounts, true)) { |
| | | // auto-create user from an authenticated container principal |
| | | user = new UserModel(username.toLowerCase()); |
| | | user.displayName = username; |
| | | user.password = Constants.EXTERNAL_ACCOUNT; |
| | | userService.updateUserModel(user); |
| | | flagWicketSession(AuthenticationType.CONTAINER); |
| | | logger.debug(MessageFormat.format("{0} authenticated and created by servlet container principal from {1}", |
| | | user.username, httpRequest.getRemoteAddr())); |
| | | return user; |
| | | } else { |
| | |
| | | Constants.CONFIG_GITBLIT, null, "mailingList"))); |
| | | model.indexedBranches = new ArrayList<String>(Arrays.asList(config.getStringList( |
| | | Constants.CONFIG_GITBLIT, null, "indexBranch"))); |
| | | model.metricAuthorExclusions = new ArrayList<String>(Arrays.asList(config.getStringList( |
| | | Constants.CONFIG_GITBLIT, null, "metricAuthorExclusions"))); |
| | | |
| | | // Custom defined properties |
| | | model.customFields = new LinkedHashMap<String, String>(); |
| | |
| | | updateList(config, "postReceiveScript", repository.postReceiveScripts); |
| | | updateList(config, "mailingList", repository.mailingLists); |
| | | updateList(config, "indexBranch", repository.indexedBranches); |
| | | updateList(config, "metricAuthorExclusions", repository.metricAuthorExclusions); |
| | | |
| | | // User Defined Properties |
| | | if (repository.customFields != null) { |
| | |
| | | if (repository != null) { |
| | | for (String teamname : userService.getTeamnamesForRepositoryRole(repository.name)) { |
| | | TeamModel team = userService.getTeamModel(teamname); |
| | | scripts.addAll(team.preReceiveScripts); |
| | | if (!ArrayUtils.isEmpty(team.preReceiveScripts)) { |
| | | scripts.addAll(team.preReceiveScripts); |
| | | } |
| | | } |
| | | } |
| | | return new ArrayList<String>(scripts); |
| | |
| | | if (repository != null) { |
| | | for (String teamname : userService.getTeamnamesForRepositoryRole(repository.name)) { |
| | | TeamModel team = userService.getTeamModel(teamname); |
| | | scripts.addAll(team.postReceiveScripts); |
| | | if (!ArrayUtils.isEmpty(team.postReceiveScripts)) { |
| | | scripts.addAll(team.postReceiveScripts); |
| | | } |
| | | } |
| | | } |
| | | return new ArrayList<String>(scripts); |