You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2017/10/10 04:42:07 UTC

[cloudstack] branch master updated: CLOUDSTACK-10101: Present the full domain name when listing user's domains in SAML2 plugin (#2280)

This is an automated email from the ASF dual-hosted git repository.

bhaisaab pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/master by this push:
     new f1c01a5  CLOUDSTACK-10101: Present the full domain name when listing user's domains in SAML2 plugin (#2280)
f1c01a5 is described below

commit f1c01a5fa228140273e412c5a0626d9adf729a15
Author: Gabriel Beims Bräscher <ga...@gmail.com>
AuthorDate: Tue Oct 10 01:42:03 2017 -0300

    CLOUDSTACK-10101: Present the full domain name when listing user's domains in SAML2 plugin (#2280)
    
    This commit is related to the Saml2 user authentication plugin.
    
    The user can list its domains. His/Her domains are presented as the
    following example:
    username/subdomainA
    username/subdomainB
    
    However, if a user has two subdomains of the same name Dom1/subdomainA
    and Dom2/subdomainA, the list is presented as follows:
    username/subdomainA
    username/subdomainA
    
    With this commit it shows the full domain name to avoid such cases.
    Thus, the domains will be presented as follows:
    username/Dom1/subdomainA
    username/Dom2/subdomainA
---
 .../cloudstack/api/command/ListAndSwitchSAMLAccountCmd.java |  1 +
 .../cloudstack/api/response/SamlUserAccountResponse.java    | 13 +++++++++++++
 ui/scripts/ui-custom/saml.js                                |  5 ++++-
 3 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/ListAndSwitchSAMLAccountCmd.java b/plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/ListAndSwitchSAMLAccountCmd.java
index 2fdf6a1..895d12f 100644
--- a/plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/ListAndSwitchSAMLAccountCmd.java
+++ b/plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/ListAndSwitchSAMLAccountCmd.java
@@ -172,6 +172,7 @@ public class ListAndSwitchSAMLAccountCmd extends BaseCmd implements APIAuthentic
                     accountResponse.setUserName(user.getUsername());
                     accountResponse.setDomainId(domain.getUuid());
                     accountResponse.setDomainName(domain.getName());
+                    accountResponse.setDomainPath(domain.getPath());
                     accountResponse.setAccountName(userAccount.getAccountName());
                     accountResponse.setIdpId(user.getExternalEntity());
                     accountResponses.add(accountResponse);
diff --git a/plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/response/SamlUserAccountResponse.java b/plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/response/SamlUserAccountResponse.java
index f0927e3..4952201 100644
--- a/plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/response/SamlUserAccountResponse.java
+++ b/plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/response/SamlUserAccountResponse.java
@@ -44,6 +44,10 @@ public class SamlUserAccountResponse extends AuthenticationCmdResponse {
     @Param(description = "The IDP ID")
     private String idpId;
 
+    @SerializedName("domainPath")
+    @Param(description = "The full qualified domain path")
+    private String domainPath;
+
     public SamlUserAccountResponse() {
         super();
         setObjectName("samluseraccount");
@@ -96,4 +100,13 @@ public class SamlUserAccountResponse extends AuthenticationCmdResponse {
     public void setIdpId(String idpId) {
         this.idpId = idpId;
     }
+
+    public String getDomainPath() {
+        return domainPath;
+    }
+
+    public void setDomainPath(String domainPath) {
+        this.domainPath = domainPath;
+    }
+
 }
diff --git a/ui/scripts/ui-custom/saml.js b/ui/scripts/ui-custom/saml.js
index 391e7f8..1879bdc 100644
--- a/ui/scripts/ui-custom/saml.js
+++ b/ui/scripts/ui-custom/saml.js
@@ -81,7 +81,10 @@
                     option.data("userId", accounts[i].userId);
                     option.data("domainId", accounts[i].domainId);
                     option.val(accounts[i].userId + '/' + accounts[i].domainId);
-                    option.html(accounts[i].accountName + "/" + accounts[i].domainName);
+                    option.html(accounts[i].accountName + accounts[i].domainPath);
+					if (accounts[i].domainName == 'ROOT') {
+						option.append('ROOT');
+					}
                     option.appendTo($domainSelect);
                 }
                 var currentAccountDomain = g_userid + '/' + g_domainid;

-- 
To stop receiving notification emails like this one, please contact
['"commits@cloudstack.apache.org" <co...@cloudstack.apache.org>'].