public ReceivePack create(final HttpServletRequest req, final Repository db) throws ServiceNotEnabledException, ServiceNotAuthorizedException { final ServiceConfig cfg = db.getConfig().get(CONFIG); String user = req.getRemoteUser(); if (cfg.set) { if (cfg.enabled) { if (user == null || "".equals(user)) user = "anonymous"; return createFor(req, db, user); } throw new ServiceNotEnabledException(); } if (user != null && !"".equals(user)) return createFor(req, db, user); throw new ServiceNotAuthorizedException(); }
public ReceivePack create(final HttpServletRequest req, final Repository db) throws ServiceNotEnabledException, ServiceNotAuthorizedException { final ServiceConfig cfg = db.getConfig().get(CONFIG); String user = req.getRemoteUser(); if (cfg.set) { if (cfg.enabled) { if (user == null || "".equals(user)) user = "anonymous"; return createFor(req, db, user); } throw new ServiceNotEnabledException(); } if (user != null && !"".equals(user)) return createFor(req, db, user); throw new ServiceNotAuthorizedException(); }
public ReceivePack create(HttpServletRequest req, Repository repo) throws ServiceNotEnabledException, ServiceNotAuthorizedException { String user = userManager.getRemoteUsername(req); String pluginKey = repo.getWorkTree().getName(); UserProfile userProfile = userManager.getUserProfile(user); final UserExtension userExtension = speakeasyService.getRemotePlugin(pluginKey, user); if (userExtension != null && !userExtension.isCanEdit()) { throw new ServiceNotAuthorizedException(); } ReceiveCommits rc = new ReceiveCommits(userProfile, userExtension, repo, speakeasyService, gitRepositoryManager); return rc.getReceivePack(); } }
throw new ServiceMayNotContinueException(e); } catch (ForbiddenException e) { throw new ServiceNotAuthorizedException(); } catch (GitUserException e) { throw new ServiceMayNotContinueException(e.getMessage(), e);