Merge "Fix project creation with plugin config if user is not project owner" into stable-2.10
This commit is contained in:
commit
fa7880a804
@ -147,7 +147,7 @@ public class CreateProject implements RestModifyView<TopLevelResource, ProjectIn
|
||||
projectControlFactory.controlFor(p.getNameKey(), currentUser.get());
|
||||
PutConfig.Input in = new PutConfig.Input();
|
||||
in.pluginConfigValues = input.pluginConfigValues;
|
||||
putConfig.get().apply(new ProjectResource(projectControl), in);
|
||||
putConfig.get().apply(projectControl, in);
|
||||
} catch (NoSuchProjectException e) {
|
||||
throw new ResourceNotFoundException(p.getName());
|
||||
}
|
||||
|
@ -114,11 +114,16 @@ public class PutConfig implements RestModifyView<ProjectResource, Input> {
|
||||
public ConfigInfo apply(ProjectResource rsrc, Input input)
|
||||
throws ResourceNotFoundException, BadRequestException,
|
||||
ResourceConflictException {
|
||||
Project.NameKey projectName = rsrc.getNameKey();
|
||||
if (!rsrc.getControl().isOwner()) {
|
||||
throw new ResourceNotFoundException(projectName.get());
|
||||
throw new ResourceNotFoundException(rsrc.getName());
|
||||
}
|
||||
return apply(rsrc.getControl(), input);
|
||||
}
|
||||
|
||||
public ConfigInfo apply(ProjectControl ctrl, Input input)
|
||||
throws ResourceNotFoundException, BadRequestException,
|
||||
ResourceConflictException {
|
||||
Project.NameKey projectName = ctrl.getProject().getNameKey();
|
||||
if (input == null) {
|
||||
throw new BadRequestException("config is required");
|
||||
}
|
||||
@ -163,7 +168,7 @@ public class PutConfig implements RestModifyView<ProjectResource, Input> {
|
||||
}
|
||||
|
||||
if (input.pluginConfigValues != null) {
|
||||
setPluginConfigValues(rsrc.getControl().getProjectState(),
|
||||
setPluginConfigValues(ctrl.getProjectState(),
|
||||
projectConfig, input.pluginConfigValues);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user