List of usage examples for org.eclipse.jgit.lfs.errors LfsUnauthorized LfsUnauthorized
public LfsUnauthorized(String operation, String name)
Constructor for LfsUnauthorized.
From source file:com.googlesource.gerrit.plugins.lfs.LfsApiServlet.java
License:Apache License
private void authorizeUser(CurrentUser user, ProjectState state, LfsRequest request) throws LfsUnauthorized { Project.NameKey projectName = state.getNameKey(); if ((request.isDownload() && !permissionBackend.user(user).project(projectName).testOrFalse(ACCESS)) || (request.isUpload()// w w w . j a va 2 s.c o m && !permissionBackend.user(user).project(projectName).testOrFalse(PUSH_AT_LEAST_ONE_REF))) { String op = request.getOperation().toLowerCase(); String project = state.getProject().getName(); String userName = user.getUserName().orElse("anonymous"); log.atFine().log("operation %s unauthorized for user %s on project %s", op, userName, project); throw new LfsUnauthorized(op, project); } }
From source file:com.googlesource.gerrit.plugins.lfs.locks.LfsLocksAction.java
License:Apache License
private void throwUnauthorizedOp(String op, ProjectState state, CurrentUser user) throws LfsUnauthorized { String project = state.getProject().getName(); String userName = user.getUserName().orElse("anonymous"); log.atFine().log("operation %s unauthorized for user %s on project %s", op, userName, project); throw new LfsUnauthorized(op, project); }