Skip to content

Commit

Permalink
Merge pull request #5792 from thomasmckay/12894-cdnurl
Browse files Browse the repository at this point in the history
fixes #12894 - remove 'users' from org update params
  • Loading branch information
thomasmckay committed Feb 29, 2016
2 parents 31617bb + 54f872d commit f74ee6b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
Expand Up @@ -14,7 +14,7 @@ angular.module('Bastion.organizations').factory('Organization',
return BastionResource('/katello/api/v2/organizations/:id/:action',
{id: '@id'},
{
update: { method: 'PUT'},
update: { method: 'PUT' },
select: {
method: 'GET',
url: '/organizations/:label/select'
Expand Down
Expand Up @@ -147,19 +147,29 @@ angular.module('Bastion.subscriptions').controller('ManifestImportController',
};

$scope.saveCdnUrl = function (organization) {
var deferred = $q.defer();
var deferred;

// @TODO hack needed to prevent upload of fields users, parent_name, and parent_id
// http://projects.theforeman.org/issues/12894
var whitelistedOrganizationObject = {},
whitelist = [
"id",
"redhat_repository_url"
];

angular.forEach(whitelist, function (key) {
whitelistedOrganizationObject[key] = organization[key];
});

organization.$update(function (response) {
deferred.resolve(response);
GlobalNotification.setSuccessMessage.push(translate('Repository URL updated'));
deferred = Organization.update(whitelistedOrganizationObject, function () {
GlobalNotification.setSuccessMessage(translate('Repository URL updated'));
$scope.refreshTable();
$scope.refreshOrganizationInfo();
}, function (response) {
deferred.reject(response);
GlobalNotification.setErrorMessage(translate("An error occurred saving the URL: ") + response.data.error.message);
});

return deferred.promise;
return deferred.$promise;
};

$scope.uploadManifest = function (content) {
Expand Down

0 comments on commit f74ee6b

Please sign in to comment.