Add repository and user/team lifecycle listener extension points
2 files added
17 files modified
| | |
| | | return new NotificationManager(settings); |
| | | } |
| | | |
| | | @Provides @Singleton IUserManager provideUserManager(IRuntimeManager runtimeManager) { |
| | | return new UserManager(runtimeManager); |
| | | @Provides @Singleton IUserManager provideUserManager( |
| | | IRuntimeManager runtimeManager, |
| | | IPluginManager pluginManager) { |
| | | |
| | | return new UserManager(runtimeManager, pluginManager); |
| | | } |
| | | |
| | | @Provides @Singleton IAuthenticationManager provideAuthenticationManager( |
| | |
| | | |
| | | @Provides @Singleton IRepositoryManager provideRepositoryManager( |
| | | IRuntimeManager runtimeManager, |
| | | IPluginManager pluginManager, |
| | | IUserManager userManager) { |
| | | |
| | | return new RepositoryManager( |
| | | runtimeManager, |
| | | pluginManager, |
| | | userManager); |
| | | } |
| | | |
| | |
| | | // configure the Gitblit singleton for minimal, non-server operation
|
| | | RuntimeManager runtime = new RuntimeManager(settings, baseFolder).start();
|
| | | NoopNotificationManager notifications = new NoopNotificationManager().start();
|
| | | UserManager users = new UserManager(runtime).start();
|
| | | RepositoryManager repositories = new RepositoryManager(runtime, users).start();
|
| | | UserManager users = new UserManager(runtime, null).start();
|
| | | RepositoryManager repositories = new RepositoryManager(runtime, null, users).start();
|
| | | FederationManager federation = new FederationManager(runtime, notifications, repositories).start();
|
| | | IGitblit gitblit = new GitblitManager(runtime, null, notifications, users, null, null, repositories, null, federation);
|
| | |
|
| | |
| | | settings.overrideSetting(ITicketService.SETTING_UPDATE_DIFFSTATS, false); |
| | | |
| | | IRuntimeManager runtimeManager = new RuntimeManager(settings, baseFolder).start(); |
| | | IRepositoryManager repositoryManager = new RepositoryManager(runtimeManager, null).start(); |
| | | IRepositoryManager repositoryManager = new RepositoryManager(runtimeManager, null, null).start(); |
| | | |
| | | String inputServiceName = settings.getString(Keys.tickets.service, BranchTicketService.class.getSimpleName()); |
| | | if (StringUtils.isEmpty(inputServiceName)) { |
| | |
| | | settings.overrideSetting(Keys.web.activityCacheDays, 0); |
| | | |
| | | IRuntimeManager runtimeManager = new RuntimeManager(settings, baseFolder).start(); |
| | | IRepositoryManager repositoryManager = new RepositoryManager(runtimeManager, null).start(); |
| | | IRepositoryManager repositoryManager = new RepositoryManager(runtimeManager, null, null).start(); |
| | | |
| | | String serviceName = settings.getString(Keys.tickets.service, BranchTicketService.class.getSimpleName()); |
| | | if (StringUtils.isEmpty(serviceName)) { |
New file |
| | |
| | | /* |
| | | * Copyright 2014 gitblit.com. |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package com.gitblit.extensions; |
| | | |
| | | import ro.fortsoft.pf4j.ExtensionPoint; |
| | | |
| | | import com.gitblit.models.RepositoryModel; |
| | | |
| | | /** |
| | | * Extension point to allow plugins to listen to major repository lifecycle events. |
| | | * |
| | | * @author James Moger |
| | | * @since 1.6.0 |
| | | */ |
| | | public abstract class RepositoryLifeCycleListener implements ExtensionPoint { |
| | | |
| | | /** |
| | | * Called after a repository has been created. |
| | | * |
| | | * @param repository |
| | | * @since 1.6.0 |
| | | */ |
| | | public abstract void onCreation(RepositoryModel repository); |
| | | |
| | | /** |
| | | * Called after a repository has been deleted. |
| | | * |
| | | * @param repository |
| | | * @since 1.6.0 |
| | | */ |
| | | public abstract void onDeletion(RepositoryModel repository); |
| | | } |
New file |
| | |
| | | /* |
| | | * Copyright 2014 gitblit.com. |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package com.gitblit.extensions; |
| | | |
| | | import ro.fortsoft.pf4j.ExtensionPoint; |
| | | |
| | | import com.gitblit.models.TeamModel; |
| | | import com.gitblit.models.UserModel; |
| | | |
| | | /** |
| | | * Extension point to allow plugins to listen to major user and team lifecycle events. |
| | | * |
| | | * @author James Moger |
| | | * @since 1.6.0 |
| | | */ |
| | | public abstract class UserTeamLifeCycleListener implements ExtensionPoint { |
| | | |
| | | /** |
| | | * Called after a user has been created. |
| | | * |
| | | * @param user |
| | | * @since 1.6.0 |
| | | */ |
| | | public abstract void onCreation(UserModel user); |
| | | |
| | | /** |
| | | * Called after a user has been deleted. |
| | | * |
| | | * @param user |
| | | * @since 1.6.0 |
| | | */ |
| | | public abstract void onDeletion(UserModel user); |
| | | |
| | | /** |
| | | * Called after a team has been created. |
| | | * |
| | | * @param team |
| | | * @since 1.6.0 |
| | | */ |
| | | public abstract void onCreation(TeamModel team); |
| | | |
| | | /** |
| | | * Called after a team has been deleted. |
| | | * |
| | | * @param team |
| | | * @since 1.6.0 |
| | | */ |
| | | public abstract void onDeletion(TeamModel team); |
| | | } |
| | |
| | | import com.gitblit.GitBlitException; |
| | | import com.gitblit.IStoredSettings; |
| | | import com.gitblit.Keys; |
| | | import com.gitblit.extensions.RepositoryLifeCycleListener; |
| | | import com.gitblit.models.ForkModel; |
| | | import com.gitblit.models.Metric; |
| | | import com.gitblit.models.RefModel; |
| | |
| | | |
| | | private final IRuntimeManager runtimeManager; |
| | | |
| | | private final IPluginManager pluginManager; |
| | | |
| | | private final IUserManager userManager; |
| | | |
| | | private final File repositoriesFolder; |
| | |
| | | |
| | | public RepositoryManager( |
| | | IRuntimeManager runtimeManager, |
| | | IPluginManager pluginManager, |
| | | IUserManager userManager) { |
| | | |
| | | this.settings = runtimeManager.getSettings(); |
| | | this.runtimeManager = runtimeManager; |
| | | this.pluginManager = pluginManager; |
| | | this.userManager = userManager; |
| | | this.repositoriesFolder = runtimeManager.getFileOrFolder(Keys.git.repositoriesFolder, "${baseFolder}/git"); |
| | | } |
| | |
| | | removeFromCachedRepositoryList(repositoryName); |
| | | // model will actually be replaced on next load because config is stale |
| | | addToCachedRepositoryList(repository); |
| | | |
| | | if (isCreate && pluginManager != null) { |
| | | for (RepositoryLifeCycleListener listener : pluginManager.getExtensions(RepositoryLifeCycleListener.class)) { |
| | | try { |
| | | listener.onCreation(repository); |
| | | } catch (Throwable t) { |
| | | logger.error(String.format("failed to call plugin onCreation %s", repositoryName), t); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | FileUtils.delete(folder, FileUtils.RECURSIVE | FileUtils.RETRY); |
| | | if (userManager.deleteRepositoryRole(repositoryName)) { |
| | | logger.info(MessageFormat.format("Repository \"{0}\" deleted", repositoryName)); |
| | | |
| | | if (pluginManager != null) { |
| | | for (RepositoryLifeCycleListener listener : pluginManager.getExtensions(RepositoryLifeCycleListener.class)) { |
| | | try { |
| | | listener.onDeletion(repository); |
| | | } catch (Throwable t) { |
| | | logger.error(String.format("failed to call plugin onDeletion %s", repositoryName), t); |
| | | } |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | } |
| | |
| | | import com.gitblit.IStoredSettings; |
| | | import com.gitblit.IUserService; |
| | | import com.gitblit.Keys; |
| | | import com.gitblit.extensions.UserTeamLifeCycleListener; |
| | | import com.gitblit.models.TeamModel; |
| | | import com.gitblit.models.UserModel; |
| | | import com.gitblit.utils.StringUtils; |
| | |
| | | |
| | | private final IRuntimeManager runtimeManager; |
| | | |
| | | private final IPluginManager pluginManager; |
| | | |
| | | private final Map<String, String> legacyBackingServices; |
| | | |
| | | private IUserService userService; |
| | | |
| | | public UserManager(IRuntimeManager runtimeManager) { |
| | | public UserManager(IRuntimeManager runtimeManager, IPluginManager pluginManager) { |
| | | this.settings = runtimeManager.getSettings(); |
| | | this.runtimeManager = runtimeManager; |
| | | this.pluginManager = pluginManager; |
| | | |
| | | // map of legacy realm backing user services |
| | | legacyBackingServices = new HashMap<String, String>(); |
| | |
| | | */ |
| | | @Override |
| | | public boolean updateUserModel(UserModel model) { |
| | | return userService.updateUserModel(model); |
| | | final boolean isCreate = null == userService.getUserModel(model.username); |
| | | if (userService.updateUserModel(model)) { |
| | | if (isCreate) { |
| | | callCreateUserListeners(model); |
| | | } |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public boolean updateUserModel(String username, UserModel model) { |
| | | return userService.updateUserModel(username, model); |
| | | final boolean isCreate = null == userService.getUserModel(username); |
| | | if (userService.updateUserModel(username, model)) { |
| | | if (isCreate) { |
| | | callCreateUserListeners(model); |
| | | } |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public boolean deleteUserModel(UserModel model) { |
| | | return userService.deleteUserModel(model); |
| | | if (userService.deleteUserModel(model)) { |
| | | callDeleteUserListeners(model); |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | |
| | | return false; |
| | | } |
| | | String usernameDecoded = StringUtils.decodeUsername(username); |
| | | return userService.deleteUser(usernameDecoded); |
| | | UserModel user = getUserModel(usernameDecoded); |
| | | if (userService.deleteUser(usernameDecoded)) { |
| | | callDeleteUserListeners(user); |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public boolean updateTeamModel(TeamModel model) { |
| | | return userService.updateTeamModel(model); |
| | | final boolean isCreate = null == userService.getTeamModel(model.name); |
| | | if (userService.updateTeamModel(model)) { |
| | | if (isCreate) { |
| | | callCreateTeamListeners(model); |
| | | } |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public boolean updateTeamModel(String teamname, TeamModel model) { |
| | | return userService.updateTeamModel(teamname, model); |
| | | final boolean isCreate = null == userService.getTeamModel(teamname); |
| | | if (userService.updateTeamModel(teamname, model)) { |
| | | if (isCreate) { |
| | | callCreateTeamListeners(model); |
| | | } |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public boolean deleteTeamModel(TeamModel model) { |
| | | return userService.deleteTeamModel(model); |
| | | if (userService.deleteTeamModel(model)) { |
| | | callDeleteTeamListeners(model); |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public boolean deleteTeam(String teamname) { |
| | | return userService.deleteTeam(teamname); |
| | | TeamModel team = userService.getTeamModel(teamname); |
| | | if (userService.deleteTeam(teamname)) { |
| | | callDeleteTeamListeners(team); |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | |
| | | public boolean deleteRepositoryRole(String role) { |
| | | return userService.deleteRepositoryRole(role); |
| | | } |
| | | |
| | | protected void callCreateUserListeners(UserModel user) { |
| | | if (pluginManager == null || user == null) { |
| | | return; |
| | | } |
| | | |
| | | for (UserTeamLifeCycleListener listener : pluginManager.getExtensions(UserTeamLifeCycleListener.class)) { |
| | | try { |
| | | listener.onCreation(user); |
| | | } catch (Throwable t) { |
| | | logger.error(String.format("failed to call plugin.onCreation%s", user.username), t); |
| | | } |
| | | } |
| | | } |
| | | |
| | | protected void callCreateTeamListeners(TeamModel team) { |
| | | if (pluginManager == null || team == null) { |
| | | return; |
| | | } |
| | | |
| | | for (UserTeamLifeCycleListener listener : pluginManager.getExtensions(UserTeamLifeCycleListener.class)) { |
| | | try { |
| | | listener.onCreation(team); |
| | | } catch (Throwable t) { |
| | | logger.error(String.format("failed to call plugin.onCreation %s", team.name), t); |
| | | } |
| | | } |
| | | } |
| | | |
| | | protected void callDeleteUserListeners(UserModel user) { |
| | | if (pluginManager == null || user == null) { |
| | | return; |
| | | } |
| | | |
| | | for (UserTeamLifeCycleListener listener : pluginManager.getExtensions(UserTeamLifeCycleListener.class)) { |
| | | try { |
| | | listener.onDeletion(user); |
| | | } catch (Throwable t) { |
| | | logger.error(String.format("failed to call plugin.onDeletion %s", user.username), t); |
| | | } |
| | | } |
| | | } |
| | | |
| | | protected void callDeleteTeamListeners(TeamModel team) { |
| | | if (pluginManager == null || team == null) { |
| | | return; |
| | | } |
| | | |
| | | for (UserTeamLifeCycleListener listener : pluginManager.getExtensions(UserTeamLifeCycleListener.class)) { |
| | | try { |
| | | listener.onDeletion(team); |
| | | } catch (Throwable t) { |
| | | logger.error(String.format("failed to call plugin.onDeletion %s", team.name), t); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | runtime.start(); |
| | | managers.add(runtime); |
| | | |
| | | // create the plugin manager instance but do not start it |
| | | loadManager(injector, IPluginManager.class); |
| | | |
| | | // start all other managers |
| | | startManager(injector, INotificationManager.class); |
| | | startManager(injector, IUserManager.class); |
| | |
| | | return null; |
| | | } |
| | | |
| | | protected <X extends IManager> X startManager(ObjectGraph injector, Class<X> clazz) { |
| | | logManager(clazz); |
| | | protected <X extends IManager> X loadManager(ObjectGraph injector, Class<X> clazz) { |
| | | X x = injector.get(clazz); |
| | | return x; |
| | | } |
| | | |
| | | protected <X extends IManager> X startManager(ObjectGraph injector, Class<X> clazz) { |
| | | X x = loadManager(injector, clazz); |
| | | logManager(clazz); |
| | | x.start(); |
| | | managers.add(x); |
| | | return x; |
| | |
| | | } |
| | | ``` |
| | | |
| | | ### Lifecycle Listener |
| | | ### Server Lifecycle Listener |
| | | |
| | | *SINCE 1.6.0* |
| | | |
| | |
| | | log.info("Gitblit is Going Down!!"); |
| | | } |
| | | } |
| | | ``` |
| | | ``` |
| | | |
| | | ### Repository Lifecycle Listener |
| | | |
| | | *SINCE 1.6.0* |
| | | |
| | | You can provide a lifecycle listener to be notified when Gitblit has created or deleted a repository. |
| | | |
| | | ```java |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import ro.fortsoft.pf4j.Extension; |
| | | import com.gitblit.extensions.RepositoryLifeCycleListener; |
| | | import com.gitblit.models.RepositoryModel; |
| | | |
| | | @Extension |
| | | public class MyRepoLifeCycleListener extends RepositoryLifeCycleListener { |
| | | |
| | | final Logger log = LoggerFactory.getLogger(getClass()); |
| | | |
| | | @Override |
| | | public void onCreation(RepositoryModel repo) { |
| | | log.info("Gitblit created {}", repo); |
| | | } |
| | | |
| | | @Override |
| | | public void onDeletion(RepositoryModel repo) { |
| | | log.info("Gitblit deleted {}", repo); |
| | | } |
| | | } |
| | | ``` |
| | | |
| | | ### User/Team Lifecycle Listener |
| | | |
| | | *SINCE 1.6.0* |
| | | |
| | | You can provide a lifecycle listener to be notified when Gitblit has created or deleted a user or a team. |
| | | |
| | | ```java |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import ro.fortsoft.pf4j.Extension; |
| | | import com.gitblit.extensions.UserTeamLifeCycleListener; |
| | | import com.gitblit.models.TeamModel; |
| | | import com.gitblit.models.UserModel; |
| | | |
| | | @Extension |
| | | public class MyUserTeamLifeCycleListener extends UserTeamLifeCycleListener { |
| | | |
| | | final Logger log = LoggerFactory.getLogger(getClass()); |
| | | |
| | | @Override |
| | | public void onCreation(UserModel user) { |
| | | log.info("Gitblit created user {}", user); |
| | | } |
| | | |
| | | @Override |
| | | public void onDeletion(UserModel user) { |
| | | log.info("Gitblit deleted user {}", user); |
| | | } |
| | | |
| | | @Override |
| | | public void onCreation(TeamModel team) { |
| | | log.info("Gitblit created team {}", team); |
| | | } |
| | | |
| | | @Override |
| | | public void onDeletion(TeamModel team) { |
| | | log.info("Gitblit deleted team {}", team); |
| | | } |
| | | } |
| | | ``` |
| | |
| | | password = admin |
| | | cookie = dd94709528bb1c83d08f3088d4043f4742891f4f |
| | | accountType = LOCAL |
| | | emailMeOnMyTicketChanges = true |
| | | role = "#admin" |
| | | role = "#notfederated" |
| | | [user "sampleuser"] |
| | | password = sampleuser |
| | | cookie = 6e07ed42149fc166206319faffdfba2e2ec82e43 |
| | | accountType = LOCAL |
| | | role = "#none" |
| | | [team "admins"] |
| | | role = "#none" |
| | | accountType = LOCAL |
| | |
| | | |
| | | IAuthenticationManager newAuthenticationManager() { |
| | | RuntimeManager runtime = new RuntimeManager(getSettings(), GitBlitSuite.BASEFOLDER).start(); |
| | | users = new UserManager(runtime).start(); |
| | | users = new UserManager(runtime, null).start(); |
| | | AuthenticationManager auth = new AuthenticationManager(runtime, users).start(); |
| | | return auth; |
| | | } |
| | |
| | | IRuntimeManager runtimeManager = new RuntimeManager(settings).start(); |
| | | IPluginManager pluginManager = new PluginManager(runtimeManager).start(); |
| | | INotificationManager notificationManager = new NotificationManager(settings).start(); |
| | | IUserManager userManager = new UserManager(runtimeManager).start(); |
| | | IRepositoryManager repositoryManager = new RepositoryManager(runtimeManager, userManager).start(); |
| | | IUserManager userManager = new UserManager(runtimeManager, pluginManager).start(); |
| | | IRepositoryManager repositoryManager = new RepositoryManager(runtimeManager, pluginManager, userManager).start(); |
| | | |
| | | BranchTicketService service = new BranchTicketService( |
| | | runtimeManager, |
| | |
| | | IRuntimeManager runtimeManager = new RuntimeManager(settings).start(); |
| | | IPluginManager pluginManager = new PluginManager(runtimeManager).start(); |
| | | INotificationManager notificationManager = new NotificationManager(settings).start(); |
| | | IUserManager userManager = new UserManager(runtimeManager).start(); |
| | | IRepositoryManager repositoryManager = new RepositoryManager(runtimeManager, userManager).start(); |
| | | IUserManager userManager = new UserManager(runtimeManager, pluginManager).start(); |
| | | IRepositoryManager repositoryManager = new RepositoryManager(runtimeManager, pluginManager, userManager).start(); |
| | | |
| | | FileTicketService service = new FileTicketService( |
| | | runtimeManager, |
| | |
| | | |
| | | private HtpasswdAuthProvider newHtpasswdAuthentication(IStoredSettings settings) { |
| | | RuntimeManager runtime = new RuntimeManager(settings, GitBlitSuite.BASEFOLDER).start(); |
| | | UserManager users = new UserManager(runtime).start(); |
| | | UserManager users = new UserManager(runtime, null).start(); |
| | | HtpasswdAuthProvider htpasswd = new HtpasswdAuthProvider(); |
| | | htpasswd.setup(runtime, users); |
| | | return htpasswd; |
| | | } |
| | | |
| | | |
| | | private AuthenticationManager newAuthenticationManager(IStoredSettings settings) { |
| | | RuntimeManager runtime = new RuntimeManager(settings, GitBlitSuite.BASEFOLDER).start(); |
| | | UserManager users = new UserManager(runtime).start(); |
| | | UserManager users = new UserManager(runtime, null).start(); |
| | | HtpasswdAuthProvider htpasswd = new HtpasswdAuthProvider(); |
| | | htpasswd.setup(runtime, users); |
| | | AuthenticationManager auth = new AuthenticationManager(runtime, users); |
| | |
| | | assertEquals("leading", user.username); |
| | | } |
| | | |
| | | |
| | | |
| | | @Test |
| | | public void testAuthenticationManager() |
| | | { |
| | |
| | | private static InMemoryDirectoryServer ds; |
| | | |
| | | private IUserManager userManager; |
| | | |
| | | |
| | | private AuthenticationManager auth; |
| | | |
| | | private MemorySettings settings; |
| | |
| | | |
| | | private LdapAuthProvider newLdapAuthentication(IStoredSettings settings) { |
| | | RuntimeManager runtime = new RuntimeManager(settings, GitBlitSuite.BASEFOLDER).start(); |
| | | userManager = new UserManager(runtime).start(); |
| | | userManager = new UserManager(runtime, null).start(); |
| | | LdapAuthProvider ldap = new LdapAuthProvider(); |
| | | ldap.setup(runtime, userManager); |
| | | return ldap; |
| | | } |
| | | |
| | | |
| | | private AuthenticationManager newAuthenticationManager(IStoredSettings settings) { |
| | | RuntimeManager runtime = new RuntimeManager(settings, GitBlitSuite.BASEFOLDER).start(); |
| | | AuthenticationManager auth = new AuthenticationManager(runtime, userManager); |
| | |
| | | assertNull(userThreeModel.getTeam("git_admins")); |
| | | assertTrue(userThreeModel.canAdmin); |
| | | } |
| | | |
| | | |
| | | @Test |
| | | public void testBindWithUser() { |
| | | settings.put(Keys.realm.ldap.bindpattern, "CN=${username},OU=US,OU=Users,OU=UserControl,OU=MyOrganization,DC=MyDomain"); |
| | |
| | | |
| | | UserModel userOneModel = auth.authenticate("UserOne", "userOnePassword".toCharArray()); |
| | | assertNotNull(userOneModel); |
| | | |
| | | |
| | | UserModel userOneModelFailedAuth = auth.authenticate("UserOne", "userTwoPassword".toCharArray()); |
| | | assertNull(userOneModelFailedAuth); |
| | | } |
| | |
| | | MemorySettings settings = new MemorySettings();
|
| | | settings.put(Keys.git.repositoriesFolder, GitBlitSuite.REPOSITORIES);
|
| | | RuntimeManager runtime = new RuntimeManager(settings, GitBlitSuite.BASEFOLDER).start();
|
| | | UserManager users = new UserManager(runtime).start();
|
| | | RepositoryManager repos = new RepositoryManager(runtime, users);
|
| | | UserManager users = new UserManager(runtime, null).start();
|
| | | RepositoryManager repos = new RepositoryManager(runtime, null, users);
|
| | | return new LuceneService(settings, repos);
|
| | | }
|
| | |
|
| | |
| | | IRuntimeManager runtimeManager = new RuntimeManager(settings).start(); |
| | | IPluginManager pluginManager = new PluginManager(runtimeManager).start(); |
| | | INotificationManager notificationManager = new NotificationManager(settings).start(); |
| | | IUserManager userManager = new UserManager(runtimeManager).start(); |
| | | IRepositoryManager repositoryManager = new RepositoryManager(runtimeManager, userManager).start(); |
| | | IUserManager userManager = new UserManager(runtimeManager, pluginManager).start(); |
| | | IRepositoryManager repositoryManager = new RepositoryManager(runtimeManager, pluginManager, userManager).start(); |
| | | |
| | | RedisTicketService service = new RedisTicketService( |
| | | runtimeManager, |
| | |
| | | |
| | | RedmineAuthProvider newRedmineAuthentication(IStoredSettings settings) { |
| | | RuntimeManager runtime = new RuntimeManager(settings, GitBlitSuite.BASEFOLDER).start(); |
| | | UserManager users = new UserManager(runtime).start(); |
| | | UserManager users = new UserManager(runtime, null).start(); |
| | | RedmineAuthProvider redmine = new RedmineAuthProvider(); |
| | | redmine.setup(runtime, users); |
| | | return redmine; |
| | |
| | | RedmineAuthProvider newRedmineAuthentication() { |
| | | return newRedmineAuthentication(getSettings()); |
| | | } |
| | | |
| | | |
| | | AuthenticationManager newAuthenticationManager() { |
| | | RuntimeManager runtime = new RuntimeManager(getSettings(), GitBlitSuite.BASEFOLDER).start(); |
| | | UserManager users = new UserManager(runtime).start(); |
| | | UserManager users = new UserManager(runtime, null).start(); |
| | | RedmineAuthProvider redmine = new RedmineAuthProvider(); |
| | | redmine.setup(runtime, users); |
| | | redmine.setTestingCurrentUserAsJson(JSON); |