Search in sources :

Example 6 with UserManager

use of com.gitblit.manager.UserManager in project gitblit by gitblit.

the class BranchTicketServiceTest method getService.

@Override
protected ITicketService getService(boolean deleteAll) throws Exception {
    IStoredSettings settings = getSettings(deleteAll);
    XssFilter xssFilter = new AllowXssFilter();
    IRuntimeManager runtimeManager = new RuntimeManager(settings, xssFilter).start();
    IPluginManager pluginManager = new PluginManager(runtimeManager).start();
    INotificationManager notificationManager = new NotificationManager(settings).start();
    IUserManager userManager = new UserManager(runtimeManager, pluginManager).start();
    IRepositoryManager repositoryManager = new RepositoryManager(runtimeManager, pluginManager, userManager).start();
    BranchTicketService service = (BranchTicketService) new BranchTicketService(runtimeManager, pluginManager, notificationManager, userManager, repositoryManager).start();
    if (deleteAll) {
        service.deleteAll(getRepository());
    }
    return service;
}
Also used : BranchTicketService(com.gitblit.tickets.BranchTicketService) NotificationManager(com.gitblit.manager.NotificationManager) INotificationManager(com.gitblit.manager.INotificationManager) IUserManager(com.gitblit.manager.IUserManager) IStoredSettings(com.gitblit.IStoredSettings) IRuntimeManager(com.gitblit.manager.IRuntimeManager) RuntimeManager(com.gitblit.manager.RuntimeManager) IRepositoryManager(com.gitblit.manager.IRepositoryManager) IRuntimeManager(com.gitblit.manager.IRuntimeManager) IPluginManager(com.gitblit.manager.IPluginManager) PluginManager(com.gitblit.manager.PluginManager) INotificationManager(com.gitblit.manager.INotificationManager) IUserManager(com.gitblit.manager.IUserManager) UserManager(com.gitblit.manager.UserManager) AllowXssFilter(com.gitblit.utils.XssFilter.AllowXssFilter) XssFilter(com.gitblit.utils.XssFilter) IPluginManager(com.gitblit.manager.IPluginManager) AllowXssFilter(com.gitblit.utils.XssFilter.AllowXssFilter) IRepositoryManager(com.gitblit.manager.IRepositoryManager) RepositoryManager(com.gitblit.manager.RepositoryManager)

Example 7 with UserManager

use of com.gitblit.manager.UserManager in project gitblit by gitblit.

the class FederationClient method main.

public static void main(String[] args) {
    Params params = new Params();
    CmdLineParser parser = new CmdLineParser(params);
    try {
        parser.parseArgument(args);
    } catch (CmdLineException t) {
        usage(parser, t);
    }
    System.out.println("Gitblit Federation Client v" + Constants.getVersion() + " (" + Constants.getBuildDate() + ")");
    // command-line specified base folder
    File baseFolder = new File(System.getProperty("user.dir"));
    if (!StringUtils.isEmpty(params.baseFolder)) {
        baseFolder = new File(params.baseFolder);
    }
    File regFile = com.gitblit.utils.FileUtils.resolveParameter(Constants.baseFolder$, baseFolder, params.registrationsFile);
    FileSettings settings = new FileSettings(regFile.getAbsolutePath());
    List<FederationModel> registrations = new ArrayList<FederationModel>();
    if (StringUtils.isEmpty(params.url)) {
        registrations.addAll(FederationUtils.getFederationRegistrations(settings));
    } else {
        if (StringUtils.isEmpty(params.token)) {
            System.out.println("Must specify --token parameter!");
            System.exit(0);
        }
        FederationModel model = new FederationModel("Gitblit");
        model.url = params.url;
        model.token = params.token;
        model.mirror = params.mirror;
        model.bare = params.bare;
        model.folder = "";
        registrations.add(model);
    }
    if (registrations.size() == 0) {
        System.out.println("No Federation Registrations!  Nothing to do.");
        System.exit(0);
    }
    // command-line specified repositories folder
    if (!StringUtils.isEmpty(params.repositoriesFolder)) {
        settings.overrideSetting(Keys.git.repositoriesFolder, new File(params.repositoriesFolder).getAbsolutePath());
    }
    // configure the Gitblit singleton for minimal, non-server operation
    XssFilter xssFilter = new AllowXssFilter();
    RuntimeManager runtime = new RuntimeManager(settings, xssFilter, baseFolder).start();
    NoopNotificationManager notifications = new NoopNotificationManager().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(null, null, runtime, null, notifications, users, null, repositories, null, federation, null);
    FederationPullService puller = new FederationPullService(gitblit, federation.getFederationRegistrations()) {

        @Override
        public void reschedule(FederationModel registration) {
        // NOOP
        }
    };
    puller.run();
    System.out.println("Finished.");
    System.exit(0);
}
Also used : FederationModel(com.gitblit.models.FederationModel) CmdLineParser(org.kohsuke.args4j.CmdLineParser) GitblitManager(com.gitblit.manager.GitblitManager) FederationManager(com.gitblit.manager.FederationManager) ArrayList(java.util.ArrayList) RuntimeManager(com.gitblit.manager.RuntimeManager) IGitblit(com.gitblit.manager.IGitblit) FederationPullService(com.gitblit.service.FederationPullService) UserManager(com.gitblit.manager.UserManager) AllowXssFilter(com.gitblit.utils.XssFilter.AllowXssFilter) XssFilter(com.gitblit.utils.XssFilter) AllowXssFilter(com.gitblit.utils.XssFilter.AllowXssFilter) RepositoryManager(com.gitblit.manager.RepositoryManager) File(java.io.File) CmdLineException(org.kohsuke.args4j.CmdLineException)

Example 8 with UserManager

use of com.gitblit.manager.UserManager in project gitblit by gitblit.

the class FileTicketServiceTest method getService.

@Override
protected ITicketService getService(boolean deleteAll) throws Exception {
    IStoredSettings settings = getSettings(deleteAll);
    XssFilter xssFilter = new AllowXssFilter();
    IRuntimeManager runtimeManager = new RuntimeManager(settings, xssFilter).start();
    IPluginManager pluginManager = new PluginManager(runtimeManager).start();
    INotificationManager notificationManager = new NotificationManager(settings).start();
    IUserManager userManager = new UserManager(runtimeManager, pluginManager).start();
    IRepositoryManager repositoryManager = new RepositoryManager(runtimeManager, pluginManager, userManager).start();
    FileTicketService service = (FileTicketService) new FileTicketService(runtimeManager, pluginManager, notificationManager, userManager, repositoryManager).start();
    if (deleteAll) {
        service.deleteAll(getRepository());
    }
    return service;
}
Also used : NotificationManager(com.gitblit.manager.NotificationManager) INotificationManager(com.gitblit.manager.INotificationManager) IUserManager(com.gitblit.manager.IUserManager) IStoredSettings(com.gitblit.IStoredSettings) IRuntimeManager(com.gitblit.manager.IRuntimeManager) RuntimeManager(com.gitblit.manager.RuntimeManager) IRepositoryManager(com.gitblit.manager.IRepositoryManager) IRuntimeManager(com.gitblit.manager.IRuntimeManager) IPluginManager(com.gitblit.manager.IPluginManager) PluginManager(com.gitblit.manager.PluginManager) INotificationManager(com.gitblit.manager.INotificationManager) IUserManager(com.gitblit.manager.IUserManager) UserManager(com.gitblit.manager.UserManager) AllowXssFilter(com.gitblit.utils.XssFilter.AllowXssFilter) XssFilter(com.gitblit.utils.XssFilter) FileTicketService(com.gitblit.tickets.FileTicketService) IPluginManager(com.gitblit.manager.IPluginManager) AllowXssFilter(com.gitblit.utils.XssFilter.AllowXssFilter) IRepositoryManager(com.gitblit.manager.IRepositoryManager) RepositoryManager(com.gitblit.manager.RepositoryManager)

Example 9 with UserManager

use of com.gitblit.manager.UserManager in project gitblit by gitblit.

the class LdapAuthenticationTest method newLdapAuthentication.

private LdapAuthProvider newLdapAuthentication(IStoredSettings settings) {
    XssFilter xssFilter = new AllowXssFilter();
    RuntimeManager runtime = new RuntimeManager(settings, xssFilter, GitBlitSuite.BASEFOLDER).start();
    userManager = new UserManager(runtime, null).start();
    LdapAuthProvider ldap = new LdapAuthProvider();
    ldap.setup(runtime, userManager);
    return ldap;
}
Also used : LdapAuthProvider(com.gitblit.auth.LdapAuthProvider) IUserManager(com.gitblit.manager.IUserManager) UserManager(com.gitblit.manager.UserManager) AllowXssFilter(com.gitblit.utils.XssFilter.AllowXssFilter) XssFilter(com.gitblit.utils.XssFilter) RuntimeManager(com.gitblit.manager.RuntimeManager) AllowXssFilter(com.gitblit.utils.XssFilter.AllowXssFilter)

Example 10 with UserManager

use of com.gitblit.manager.UserManager in project gitblit by gitblit.

the class AuthenticationManagerTest method newAuthenticationManager.

IAuthenticationManager newAuthenticationManager() {
    XssFilter xssFilter = new AllowXssFilter();
    RuntimeManager runtime = new RuntimeManager(getSettings(), xssFilter, GitBlitSuite.BASEFOLDER).start();
    users = new UserManager(runtime, null).start();
    final Map<String, UserModel> virtualUsers = new HashMap<String, UserModel>();
    users.setUserService(new IUserService() {

        @Override
        public void setup(IRuntimeManager runtimeManager) {
        }

        @Override
        public String getCookie(UserModel model) {
            return null;
        }

        @Override
        public UserModel getUserModel(char[] cookie) {
            return null;
        }

        @Override
        public UserModel getUserModel(String username) {
            return virtualUsers.get(username);
        }

        @Override
        public boolean updateUserModel(UserModel model) {
            virtualUsers.put(model.username, model);
            return true;
        }

        @Override
        public boolean updateUserModels(Collection<UserModel> models) {
            return false;
        }

        @Override
        public boolean updateUserModel(String username, UserModel model) {
            virtualUsers.put(username, model);
            return true;
        }

        @Override
        public boolean deleteUserModel(UserModel model) {
            return false;
        }

        @Override
        public boolean deleteUser(String username) {
            return false;
        }

        @Override
        public List<String> getAllUsernames() {
            return null;
        }

        @Override
        public List<UserModel> getAllUsers() {
            return null;
        }

        @Override
        public List<String> getAllTeamNames() {
            return null;
        }

        @Override
        public List<TeamModel> getAllTeams() {
            return null;
        }

        @Override
        public List<String> getTeamNamesForRepositoryRole(String role) {
            return null;
        }

        @Override
        public TeamModel getTeamModel(String teamname) {
            return null;
        }

        @Override
        public boolean updateTeamModel(TeamModel model) {
            return false;
        }

        @Override
        public boolean updateTeamModels(Collection<TeamModel> models) {
            return false;
        }

        @Override
        public boolean updateTeamModel(String teamname, TeamModel model) {
            return false;
        }

        @Override
        public boolean deleteTeamModel(TeamModel model) {
            return false;
        }

        @Override
        public boolean deleteTeam(String teamname) {
            return false;
        }

        @Override
        public List<String> getUsernamesForRepositoryRole(String role) {
            return null;
        }

        @Override
        public boolean renameRepositoryRole(String oldRole, String newRole) {
            return false;
        }

        @Override
        public boolean deleteRepositoryRole(String role) {
            return false;
        }
    });
    AuthenticationManager auth = new AuthenticationManager(runtime, users).start();
    return auth;
}
Also used : HashMap(java.util.HashMap) IRuntimeManager(com.gitblit.manager.IRuntimeManager) RuntimeManager(com.gitblit.manager.RuntimeManager) UserModel(com.gitblit.models.UserModel) IRuntimeManager(com.gitblit.manager.IRuntimeManager) AuthenticationManager(com.gitblit.manager.AuthenticationManager) IAuthenticationManager(com.gitblit.manager.IAuthenticationManager) TeamModel(com.gitblit.models.TeamModel) UserManager(com.gitblit.manager.UserManager) IUserService(com.gitblit.IUserService) AllowXssFilter(com.gitblit.utils.XssFilter.AllowXssFilter) XssFilter(com.gitblit.utils.XssFilter) AllowXssFilter(com.gitblit.utils.XssFilter.AllowXssFilter) List(java.util.List)

Aggregations

RuntimeManager (com.gitblit.manager.RuntimeManager)12 UserManager (com.gitblit.manager.UserManager)12 XssFilter (com.gitblit.utils.XssFilter)12 AllowXssFilter (com.gitblit.utils.XssFilter.AllowXssFilter)12 RepositoryManager (com.gitblit.manager.RepositoryManager)6 IRuntimeManager (com.gitblit.manager.IRuntimeManager)5 IUserManager (com.gitblit.manager.IUserManager)5 IStoredSettings (com.gitblit.IStoredSettings)4 INotificationManager (com.gitblit.manager.INotificationManager)4 IPluginManager (com.gitblit.manager.IPluginManager)4 IRepositoryManager (com.gitblit.manager.IRepositoryManager)4 NotificationManager (com.gitblit.manager.NotificationManager)4 PluginManager (com.gitblit.manager.PluginManager)4 AuthenticationManager (com.gitblit.manager.AuthenticationManager)3 HtpasswdAuthProvider (com.gitblit.auth.HtpasswdAuthProvider)2 RedmineAuthProvider (com.gitblit.auth.RedmineAuthProvider)2 BranchTicketService (com.gitblit.tickets.BranchTicketService)2 IUserService (com.gitblit.IUserService)1 LdapAuthProvider (com.gitblit.auth.LdapAuthProvider)1 FederationManager (com.gitblit.manager.FederationManager)1