public boolean isUserAdmin(Username username) { if (!isSecurityEnabled()) { return true; } return goConfigService.isUserAdmin(username); }
public boolean isUserAdminOfGroup(final CaseInsensitiveString userName, String groupName) { if (!isSecurityEnabled()) { return true; } PipelineConfigs group = null; if (groupName != null) { group = getCurrentConfig().findGroup(groupName); } return isUserAdmin(new Username(userName)) || isUserAdminOfGroup(userName, group); }
protected final boolean isAuthorized() { if (goConfigService.isUserAdmin(currentUser)) { return true; } result.forbidden(forbiddenToEdit(), forbidden()); return false; }
protected final boolean isAuthorized() { if (goConfigService.isUserAdmin(currentUser)) { return true; } result.forbidden(forbiddenToEdit(), forbidden()); return false; }
private boolean isAuthorized() { if (goConfigService.isUserAdmin(currentUser)) { return true; } result.forbidden(forbiddenToEdit(), forbidden()); return false; }
private final boolean isAuthorized() { if (goConfigService.isUserAdmin(currentUser)) { return true; } result.forbidden(forbiddenToEdit(), forbidden()); return false; } }
protected final boolean isAuthorized() { if (goConfigService.isUserAdmin(currentUser)) { return true; } result.forbidden(forbiddenToEdit(), forbidden()); return false; }
public ServerBackup startBackup(Username username, HttpLocalizedOperationResult result) { if (!goConfigService.isUserAdmin(username)) { result.forbidden("Unauthorized to initiate Go backup as you are not a Go administrator", HealthStateType.forbidden()); return null; } return performBackupWithoutAuthentication(username, result, BackupInitiator.USER); }
@Deprecated() public CruiseConfig loadCruiseConfigForEdit(Username username, HttpLocalizedOperationResult result) { if (!isUserAdmin(username) && !isUserTemplateAdmin(username)) { result.forbidden(LocalizedMessage.forbiddenToEdit(), HealthStateType.forbidden()); } return clonedConfigForEdit(); }
private boolean isAuthorized() { if (!(goConfigService.isUserAdmin(username) || goConfigService.isGroupAdministrator(username.getUsername()))) { result.forbidden(forbiddenToEdit(), forbidden()); return false; } return true; } }
private boolean isAuthorized() { if (!(goConfigService.isUserAdmin(currentUser) || goConfigService.isGroupAdministrator(currentUser.getUsername()))) { result.forbidden(forbiddenToEdit(), forbidden()); return false; } return true; } }
private boolean isAuthorized() { if (!(goConfigService.isUserAdmin(username) || goConfigService.isGroupAdministrator(username.getUsername()))) { result.forbidden(forbiddenToEdit(), forbidden()); return false; } return true; } }
private boolean isAuthorized() { if (!(goConfigService.isUserAdmin(username) || goConfigService.isGroupAdministrator(username.getUsername()))) { result.forbidden(forbiddenToEdit(), forbidden()); return false; } return true; } }
protected final boolean isAuthorized() { if (!(goConfigService.isUserAdmin(currentUser) || goConfigService.isGroupAdministrator(currentUser.getUsername()))) { result.forbidden(forbiddenToEdit(), forbidden()); return false; } return true; } }
protected boolean isAuthorized() { if (!(goConfigService.isUserAdmin(username) || goConfigService.isGroupAdministrator(username.getUsername()))) { result.forbidden(forbiddenToEdit(), forbidden()); return false; } return true; }
public void notifyMaterialsForUpdate(Username username, Object params, HttpLocalizedOperationResult result) { if (!goConfigService.isUserAdmin(username)) { result.forbidden("Unauthorized to access this API.", HealthStateType.forbidden()); return; } final Map attributes = (Map) params; if (attributes.containsKey(MaterialUpdateService.TYPE)) { PostCommitHookMaterialType materialType = postCommitHookMaterialType.toType((String) attributes.get(MaterialUpdateService.TYPE)); if (!materialType.isKnown()) { result.badRequest("The request could not be understood by Go Server due to malformed syntax. The client SHOULD NOT repeat the request without modifications."); return; } final PostCommitHookImplementer materialTypeImplementer = materialType.getImplementer(); final CruiseConfig cruiseConfig = goConfigService.currentCruiseConfig(); Set<Material> allUniquePostCommitSchedulableMaterials = materialConfigConverter.toMaterials(cruiseConfig.getAllUniquePostCommitSchedulableMaterials()); final Set<Material> prunedMaterialList = materialTypeImplementer.prune(allUniquePostCommitSchedulableMaterials, attributes); if (prunedMaterialList.isEmpty()) { result.notFound("Unable to find material. Materials must be configured not to poll for new changes before they can be used with the notification mechanism.", HealthStateType.general(HealthStateScope.GLOBAL)); return; } for (Material material : prunedMaterialList) { updateMaterial(material); } result.accepted("The material is now scheduled for an update. Please check relevant pipeline(s) for status."); } else { result.badRequest("The request could not be understood by Go Server due to malformed syntax. The client SHOULD NOT repeat the request without modifications."); } }