Skip to content

Commit

Permalink
Remove getServiceAccount from ScimUser
Browse files Browse the repository at this point in the history
  • Loading branch information
garaimanoj committed Sep 20, 2024
1 parent c23f974 commit 0445451
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ public IamAccount entityFromDto(ScimUser scimUser) {
account.setActive(scimUser.getActive());
}

if (scimUser.getServiceAccount() != null) {
account.setServiceAccount(scimUser.getServiceAccount());
if (scimUser.hasServiceAccountStatus()) {
account.setServiceAccount(scimUser.getIndigoUser().getServiceAccount());
}

if (scimUser.getPassword() != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,7 @@ public Boolean getActive() {

return active;
}

public Boolean getServiceAccount() {

return indigoUser != null && indigoUser.getServiceAccount() != null && indigoUser.getServiceAccount();
}


public List<ScimEmail> getEmails() {

return emails;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ private void prepareReplacers(List<AccountUpdater> updaters, ScimUser user, IamA
addUpdater(updaters, Objects::nonNull, user::getActive, replace::active);

if (user.hasServiceAccountStatus()) {
addUpdater(updaters, Objects::nonNull, user::getServiceAccount, replace::serviceAccount);
addUpdater(updaters, Objects::nonNull, user.getIndigoUser()::getServiceAccount, replace::serviceAccount);
}

if (user.hasEmails()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
limitations under the License.
-->
<button ng-if="$ctrl.aupIsEnabled() && !$ctrl.user.serviceAccount && !$ctrl.isMe()"
<button ng-if="$ctrl.aupIsEnabled() && !$ctrl.indigoUser().serviceAccount && !$ctrl.isMe()"
class="btn btn-warning btn-block"
style="margin-top: 5px"
ng-click="$ctrl.openRequestAupSignatureModal()"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
self.aupIsEnabled = function () {
return self.aup !== null;
};
self.indigoUser = function () {
return self.user['urn:indigo-dc:scim:schemas:IndigoUser'];
};

self.openRequestAupSignatureModal = function() {
self.enabled = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<!-- Set user as service account button -->
<button class="btn btn-primary btn-block"
style="margin-top: 5px"
ng-if="!$ctrl.user.serviceAccount && !$ctrl.isMe()"
ng-if="!$ctrl.indigoUser().serviceAccount && !$ctrl.isMe()"
ng-click="$ctrl.openDialog()"
ng-enabled="$ctrl.enabled"
name="disable-user-btn">
Expand All @@ -28,7 +28,7 @@

<!-- Revoke user as service account button -->
<button class="btn btn-primary btn-block"
ng-if="$ctrl.user.serviceAccount && !$ctrl.isMe()"
ng-if="$ctrl.indigoUser().serviceAccount && !$ctrl.isMe()"
style="margin-top: 5px"
ng-click="$ctrl.openDialog()"
ng-enabled="$ctrl.enabled"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
self.handleSuccess = function() {
self.enabled = true;
self.userCtrl.loadUser().then(function(user) {
if (user.serviceAccount) {
if (self.indigoUser().serviceAccount) {
toaster.pop({
type: 'success',
body:
Expand Down Expand Up @@ -64,7 +64,7 @@
var modalOptions = null;
var updateServiceAccountStatusFunc = null;

if (self.user.serviceAccount) {
if (self.indigoUser().serviceAccount) {
modalOptions = {
closeButtonText: 'Cancel',
actionButtonText: 'Revoke service account status',
Expand Down Expand Up @@ -94,6 +94,7 @@


self.isMe = function() { return Utils.isMe(self.user.id); };
self.indigoUser = function() { return self.userCtrl.indigoUser(); };
}

angular.module('dashboardApp').component('userServiceAccount', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
limitations under the License.
-->
<button ng-if="$ctrl.aupIsEnabled() && !$ctrl.user.serviceAccount && !$ctrl.isMe()"
<button ng-if="$ctrl.aupIsEnabled() && !$ctrl.indigoUser().serviceAccount && !$ctrl.isMe()"
class="btn btn-success btn-block"
style="margin-top: 5px"
ng-click="$ctrl.openSignAupOnBehalfModal()"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
self.aupIsEnabled = function () {
return self.aup !== null;
};
self.indigoUser = function () {
return self.user['urn:indigo-dc:scim:schemas:IndigoUser'];
};


self.openSignAupOnBehalfModal = function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@
return Utils.isMe(self.user.id);
};

self.indigoUser = function () {
return self.user['urn:indigo-dc:scim:schemas:IndigoUser'];
};

self.canManageLinkedAccounts = function () {
if (!self.accountLinkingEnabled) {
return self.isVoAdmin();
Expand Down

0 comments on commit 0445451

Please sign in to comment.