本文整理汇总了Java中com.google.gerrit.server.CurrentUser类的典型用法代码示例。如果您正苦于以下问题:Java CurrentUser类的具体用法?Java CurrentUser怎么用?Java CurrentUser使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CurrentUser类属于com.google.gerrit.server包,在下文中一共展示了CurrentUser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shouldReplicate
import com.google.gerrit.server.CurrentUser; //导入依赖的package包/类
private boolean shouldReplicate(ProjectState projectState, CurrentUser user)
throws PermissionBackendException {
if (!config.replicateHiddenProjects()
&& projectState.getProject().getState()
== com.google.gerrit.extensions.client.ProjectState.HIDDEN) {
return false;
}
try {
permissionBackend
.user(user)
.project(projectState.getNameKey())
.check(ProjectPermission.ACCESS);
return true;
} catch (AuthException e) {
return false;
}
}
示例2: parseIdOnBehalfOf
import com.google.gerrit.server.CurrentUser; //导入依赖的package包/类
private IdentifiedUser parseIdOnBehalfOf(@Nullable CurrentUser caller, String id)
throws AuthException, OrmException, IOException, ConfigInvalidException {
if (id.equals("self")) {
CurrentUser user = self.get();
if (user.isIdentifiedUser()) {
return user.asIdentifiedUser();
} else if (user instanceof AnonymousUser) {
throw new AuthException("Authentication required");
} else {
return null;
}
}
Account match = resolver.find(id);
if (match == null) {
return null;
}
CurrentUser realUser = caller != null ? caller.getRealUser() : null;
return userFactory.runAs(null, match.getId(), realUser);
}
示例3: PostGpgKeys
import com.google.gerrit.server.CurrentUser; //导入依赖的package包/类
@Inject
PostGpgKeys(
@GerritPersonIdent Provider<PersonIdent> serverIdent,
Provider<CurrentUser> self,
Provider<PublicKeyStore> storeProvider,
GerritPublicKeyChecker.Factory checkerFactory,
AddKeySender.Factory addKeyFactory,
Provider<InternalAccountQuery> accountQueryProvider,
ExternalIds externalIds,
ExternalIdsUpdate.User externalIdsUpdateFactory) {
this.serverIdent = serverIdent;
this.self = self;
this.storeProvider = storeProvider;
this.checkerFactory = checkerFactory;
this.addKeyFactory = addKeyFactory;
this.accountQueryProvider = accountQueryProvider;
this.externalIds = externalIds;
this.externalIdsUpdateFactory = externalIdsUpdateFactory;
}
示例4: ChangesCollection
import com.google.gerrit.server.CurrentUser; //导入依赖的package包/类
@Inject
ChangesCollection(
Provider<ReviewDb> db,
Provider<CurrentUser> user,
Provider<QueryChanges> queryFactory,
DynamicMap<RestView<ChangeResource>> views,
ChangeFinder changeFinder,
CreateChange createChange,
ChangeResource.Factory changeResourceFactory,
PermissionBackend permissionBackend) {
this.db = db;
this.user = user;
this.queryFactory = queryFactory;
this.views = views;
this.changeFinder = changeFinder;
this.createChange = createChange;
this.changeResourceFactory = changeResourceFactory;
this.permissionBackend = permissionBackend;
}
示例5: initVelocityModel
import com.google.gerrit.server.CurrentUser; //导入依赖的package包/类
private PluginVelocityModel initVelocityModel(HttpServletRequest request) throws IOException {
PluginVelocityModel model = modelProvider.get();
GitHubLogin gitHubLogin = loginProvider.get(request);
model.put("myself", gitHubLogin.getMyself());
model.put("config", config);
CurrentUser user = userProvider.get();
if (user.isIdentifiedUser()) {
model.put("user", user);
model.put("hub", gitHubLogin.getHub());
model.put("scopeCookie", gitHubLogin.getScopesKeyFromCookie(request));
}
for (Entry<String, String[]> reqPar : request.getParameterMap().entrySet()) {
model.put(reqPar.getKey(), reqPar.getValue());
}
return model;
}
示例6: Upload
import com.google.gerrit.server.CurrentUser; //导入依赖的package包/类
@Inject
Upload(
Provider<CurrentUser> userProvider,
VisibleRefFilter.Factory refFilterFactory,
TransferConfig transferConfig,
DynamicSet<UploadPackInitializer> uploadPackInitializers,
DynamicSet<PreUploadHook> preUploadHooks,
UploadValidators.Factory uploadValidatorsFactory,
ThreadLocalRequestContext threadContext,
ProjectCache projectCache,
PermissionBackend permissionBackend) {
this.userProvider = userProvider;
this.refFilterFactory = refFilterFactory;
this.transferConfig = transferConfig;
this.uploadPackInitializers = uploadPackInitializers;
this.preUploadHooks = preUploadHooks;
this.uploadValidatorsFactory = uploadValidatorsFactory;
this.threadContext = threadContext;
this.projectCache = projectCache;
this.permissionBackend = permissionBackend;
}
示例7: Receive
import com.google.gerrit.server.CurrentUser; //导入依赖的package包/类
@Inject
Receive(
Provider<CurrentUser> userProvider,
ProjectCache projectCache,
AsyncReceiveCommits.Factory factory,
TransferConfig config,
DynamicSet<ReceivePackInitializer> receivePackInitializers,
DynamicSet<PostReceiveHook> postReceiveHooks,
ThreadLocalRequestContext threadContext,
PermissionBackend permissionBackend) {
this.userProvider = userProvider;
this.projectCache = projectCache;
this.factory = factory;
this.config = config;
this.receivePackInitializers = receivePackInitializers;
this.postReceiveHooks = postReceiveHooks;
this.threadContext = threadContext;
this.permissionBackend = permissionBackend;
}
示例8: setUp
import com.google.gerrit.server.CurrentUser; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
Injector injector = Guice.createInjector(new InMemoryModule());
injector.injectMembers(this);
lifecycle = new LifecycleManager();
lifecycle.add(injector);
lifecycle.start();
db = schemaFactory.open();
schemaCreator.create(db);
// Need to create at least one user to be admin before creating a "normal"
// registered user.
// See AccountManager#create().
accountManager.authenticate(AuthRequest.forUser("admin")).getAccountId();
admins = groupCache.get(new AccountGroup.NameKey("Administrators")).orElse(null).getGroupUUID();
setUpPermissions();
Account.Id userId = accountManager.authenticate(AuthRequest.forUser("user")).getAccountId();
user = userFactory.create(userId);
Project.NameKey name = new Project.NameKey("project");
InMemoryRepository inMemoryRepo = repoManager.createRepository(name);
project = new ProjectConfig(name);
project.load(inMemoryRepo);
repo = new TestRepository<>(inMemoryRepo);
requestContext.setContext(
new RequestContext() {
@Override
public CurrentUser getUser() {
return user;
}
@Override
public Provider<ReviewDb> getReviewDbProvider() {
return Providers.of(db);
}
});
}
示例9: GetAccess
import com.google.gerrit.server.CurrentUser; //导入依赖的package包/类
@Inject
public GetAccess(
Provider<CurrentUser> self,
PermissionBackend permissionBackend,
GroupControl.Factory groupControlFactory,
AllProjectsName allProjectsName,
ProjectCache projectCache,
MetaDataUpdate.Server metaDataUpdateFactory,
ProjectJson projectJson,
GroupBackend groupBackend,
GroupJson groupJson) {
this.user = self;
this.permissionBackend = permissionBackend;
this.groupControlFactory = groupControlFactory;
this.allProjectsName = allProjectsName;
this.projectJson = projectJson;
this.projectCache = projectCache;
this.metaDataUpdateFactory = metaDataUpdateFactory;
this.groupBackend = groupBackend;
this.groupJson = groupJson;
}
示例10: ActionJson
import com.google.gerrit.server.CurrentUser; //导入依赖的package包/类
@Inject
ActionJson(
Revisions revisions,
ChangeJson.Factory changeJsonFactory,
ChangeResource.Factory changeResourceFactory,
UiActions uiActions,
DynamicMap<RestView<ChangeResource>> changeViews,
DynamicSet<ActionVisitor> visitorSet,
Provider<CurrentUser> userProvider) {
this.revisions = revisions;
this.changeJsonFactory = changeJsonFactory;
this.changeResourceFactory = changeResourceFactory;
this.uiActions = uiActions;
this.changeViews = changeViews;
this.visitorSet = visitorSet;
this.userProvider = userProvider;
}
示例11: ChangeResource
import com.google.gerrit.server.CurrentUser; //导入依赖的package包/类
@Inject
ChangeResource(
Provider<ReviewDb> db,
AccountCache accountCache,
ApprovalsUtil approvalUtil,
PatchSetUtil patchSetUtil,
PermissionBackend permissionBackend,
StarredChangesUtil starredChangesUtil,
ProjectCache projectCache,
@Assisted ChangeNotes notes,
@Assisted CurrentUser user) {
this.db = db;
this.accountCache = accountCache;
this.approvalUtil = approvalUtil;
this.patchSetUtil = patchSetUtil;
this.permissionBackend = permissionBackend;
this.starredChangesUtil = starredChangesUtil;
this.projectCache = projectCache;
this.notes = notes;
this.user = user;
}
示例12: VisibleRefFilter
import com.google.gerrit.server.CurrentUser; //导入依赖的package包/类
@Inject
VisibleRefFilter(
TagCache tagCache,
ChangeNotes.Factory changeNotesFactory,
@Nullable SearchingChangeCacheImpl changeCache,
Provider<ReviewDb> db,
Provider<CurrentUser> user,
PermissionBackend permissionBackend,
@Assisted ProjectState projectState,
@Assisted Repository git) {
this.tagCache = tagCache;
this.changeNotesFactory = changeNotesFactory;
this.changeCache = changeCache;
this.db = db;
this.user = user;
this.permissionBackend = permissionBackend;
this.perm =
permissionBackend.user(user).database(db).project(projectState.getProject().getNameKey());
this.projectState = projectState;
this.git = git;
}
示例13: getLabelTypes
import com.google.gerrit.server.CurrentUser; //导入依赖的package包/类
/** All available label types for this branch and user. */
public LabelTypes getLabelTypes(Branch.NameKey destination, CurrentUser user) {
List<LabelType> all = getLabelTypes().getLabelTypes();
List<LabelType> r = Lists.newArrayListWithCapacity(all.size());
for (LabelType l : all) {
List<String> refs = l.getRefPatterns();
if (refs == null) {
r.add(l);
} else {
for (String refPattern : refs) {
if (RefConfigSection.isValid(refPattern) && match(destination, refPattern, user)) {
r.add(l);
break;
}
}
}
}
return new LabelTypes(r);
}
示例14: ProjectAccessFactory
import com.google.gerrit.server.CurrentUser; //导入依赖的package包/类
@Inject
ProjectAccessFactory(
GroupBackend groupBackend,
ProjectCache projectCache,
PermissionBackend permissionBackend,
Provider<CurrentUser> user,
GroupControl.Factory groupControlFactory,
MetaDataUpdate.Server metaDataUpdateFactory,
AllProjectsName allProjectsName,
WebLinks webLinks,
@Assisted final Project.NameKey name) {
this.groupBackend = groupBackend;
this.projectCache = projectCache;
this.permissionBackend = permissionBackend;
this.user = user;
this.groupControlFactory = groupControlFactory;
this.metaDataUpdateFactory = metaDataUpdateFactory;
this.allProjectsName = allProjectsName;
this.webLinks = webLinks;
this.projectName = name;
}
示例15: batchAbandon
import com.google.gerrit.server.CurrentUser; //导入依赖的package包/类
public void batchAbandon(
BatchUpdate.Factory updateFactory,
Project.NameKey project,
CurrentUser user,
Collection<ChangeData> changes,
String msgTxt)
throws RestApiException, UpdateException {
batchAbandon(
updateFactory,
project,
user,
changes,
msgTxt,
NotifyHandling.ALL,
ImmutableListMultimap.of());
}