import static java.util.Collections.singletonList;
import static org.sonar.server.permission.ws.Parameters.PARAM_TEMPLATE_ID_EXPLICIT;
-import static org.sonar.server.permission.ws.Parameters.createProjectParameter;
import static org.sonar.server.permission.ws.Parameters.createExplicitTemplateId;
+import static org.sonar.server.permission.ws.Parameters.createProjectParameter;
public class ApplyTemplateAction implements PermissionsWsAction {
private final DbClient dbClient;
DbSession dbSession = dbClient.openSession(false);
try {
PermissionTemplateDto template = finder.getTemplate(dbSession, templateUuid);
- ComponentDto project = finder.getProject(dbSession, wsRequest);
+ ComponentDto project = finder.getProject(dbSession, WsProjectRef.fromRequest(wsRequest));
ApplyPermissionTemplateQuery query = ApplyPermissionTemplateQuery.create(
template.getUuid(),
import com.google.common.base.Optional;
import javax.annotation.CheckForNull;
-import org.sonar.api.server.ws.Request;
import org.sonar.db.DbClient;
import org.sonar.db.DbSession;
import org.sonar.db.component.ComponentDto;
return Optional.of(componentFinder.getProjectByUuidOrKey(dbSession, wsProjectRef.uuid(), wsProjectRef.key()));
}
- public ComponentDto getProject(DbSession dbSession, Request wsRequest) {
- WsProjectRef projectRef = WsProjectRef.fromRequest(wsRequest);
-
+ public ComponentDto getProject(DbSession dbSession, WsProjectRef projectRef) {
return componentFinder.getProjectByUuidOrKey(dbSession, projectRef.uuid(), projectRef.key());
}