Bug 995371 - [origin_ui_73]Can not add member to domain with login parameter when the user has '+' in the login attribute
[origin_ui_73]Can not add member to domain with login parameter when the use...
Status: CLOSED NOTABUG
Product: OpenShift Online
Classification: Red Hat
Component: REST API (Show other bugs)
2.x
Unspecified Unspecified
medium Severity medium
: ---
: ---
Assigned To: Clayton Coleman
libra bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-08-09 04:04 EDT by Wei Sun
Modified: 2015-05-14 20:55 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-08-19 14:50:13 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Wei Sun 2013-08-09 04:04:05 EDT
Description of problem:
Register two accounts(wsun+mem1@redhat.com  and  xtian+t2@redhat.com) and create a domain with wsun+mem1@redhat.com,and then try to add xtian+t2@redhat.com to  domain,but it failed,it shows "The requested cloud user was not found."  

Version-Release number of selected component (if applicable):
fork_ami_membership_origin_ui_73_754

How reproducible:
Always

Steps to Reproduce:
1.Register two accounts wsun+mem1@redhat.com  and  xtian+t2@redhat.com)
2.Create a domain with wsun+mem1@redhat.com
3.Add xtian+t2@redhat.com to domain

Actual results:
[wsun@dhcp-8-229 ~]$ curl -k -H 'Accept: application/xml' -u wsun+mem1@redhat.com:change https://ec2-50-17-73-69.compute-1.amazonaws.com/broker/rest/domains/wsunmemfor754/members -d role=view -d login="xtian+t2@redhat.com" -X POST
<?xml version="1.0" encoding="UTF-8"?>
<response>
  <status>not_found</status>
  <type nil="true"></type>
  <data>
    <datum nil="true"></datum>
  </data>
  <messages>
    <message>
      <severity>error</severity>
      <text>The requested cloud user was not found.</text>
      <exit-code>1</exit-code>
      <field nil="true"></field>
    </message>
  </messages>
  <version>1.6</version>
  <api-version>1.6</api-version>
  <supported-api-versions>
    <supported-api-version>1.0</supported-api-version>
    <supported-api-version>1.1</supported-api-version>
    <supported-api-version>1.2</supported-api-version>
    <supported-api-version>1.3</supported-api-version>
    <supported-api-version>1.4</supported-api-version>
    <supported-api-version>1.5</supported-api-version>
    <supported-api-version>1.6</supported-api-version>
  </supported-api-versions>
</response>

[wsun@dhcp-8-229 ~]$ curl -k -H 'Accept: application/xml' -u wsun+mem1@redhat.com:change https://ec2-50-17-73-69.compute-1.amazonaws.com/broker/rest/domains/wsunmemfor754/members -d role=view -d id=520484f6bfa134aadf000018 -X POST
<?xml version="1.0" encoding="UTF-8"?>
<response>
  <status>not_found</status>
  <type nil="true"></type>
  <data>
    <datum nil="true"></datum>
  </data>
  <messages>
    <message>
      <severity>error</severity>
      <text>The requested cloud user was not found.</text>
      <exit-code>1</exit-code>
      <field nil="true"></field>
    </message>
  </messages>
  <version>1.6</version>
  <api-version>1.6</api-version>
  <supported-api-versions>
    <supported-api-version>1.0</supported-api-version>
    <supported-api-version>1.1</supported-api-version>
    <supported-api-version>1.2</supported-api-version>
    <supported-api-version>1.3</supported-api-version>
    <supported-api-version>1.4</supported-api-version>
    <supported-api-version>1.5</supported-api-version>
    <supported-api-version>1.6</supported-api-version>
  </supported-api-versions>
</response>


Expected results:
Could add memeber to domain successfully

Additional info:
        <link>
          <rel>Add one or more members to this domain</rel>
          <method>POST</method>
          <href>https://ec2-50-17-73-69.compute-1.amazonaws.com/broker/rest/domains/wsunmemfor754/members</href>
          <required-params>
            <param>
              <name>role</name>
              <type>string</type>
              <description>The role the user should have on the domain</description>
              <valid-options>
                <valid-option>view</valid-option>
                <valid-option>edit</valid-option>
                <valid-option>admin</valid-option>
              </valid-options>
              <invalid-options/>
            </param>
          </required-params>
          <optional-params>
            <optional-param>
              <name>id</name>
              <type>string</type>
              <description>Unique identifier of the user</description>
              <valid-options/>
              <default-value nil="true"></default-value>
            </optional-param>
            <optional-param>
              <name>login</name>
              <type>string</type>
              <description>The user's login attribute</description>
              <valid-options/>
              <default-value nil="true"></default-value>
            </optional-param>
          </optional-params>
        </link>
Comment 1 Clayton Coleman 2013-08-09 11:22:26 EDT
Fixed in https://github.com/smarterclayton/origin-server/commit/2248cb9544d00dfa5cf740288297506f180e754b, will have a new fork ami today.
Comment 2 Wei Sun 2013-08-12 02:53:18 EDT
Will check this bug after having a new fork ami.
Comment 3 Wei Sun 2013-08-13 22:34:29 EDT
Check this bug on fork_ami_membership_origin_ui_73_765,can add member to domain with id parameter,but can not add member to domain with login parameter.

Result:
1.Can not add member to domain with login parameter
[wsun@dhcp-8-229 ~]$ curl -k -H 'Accept: application/xml' -u wsun+mem1@redhat.com:changeme https://ec2-54-234-254-66.compute-1.amazonaws.com/broker/rest/domains/wsunmemfork765/members -d role=view -d login="wsun+mem3@redhat.com" -X POST
<?xml version="1.0" encoding="UTF-8"?>
<response>
  <status>not_found</status>
  <type nil="true"></type>
  <data>
    <datum nil="true"></datum>
  </data>
  <messages>
    <message>
      <severity>error</severity>
      <text>The requested cloud user was not found.</text>
      <exit-code>1</exit-code>
      <field nil="true"></field>
    </message>
  </messages>
 
</response>

2.Can add member to domain with id parameter
[wsun@dhcp-8-229 ~]$ curl -k -H 'Accept: application/xml' -u wsun+mem1@redhat.com:changeme https://ec2-54-234-254-66.compute-1.amazonaws.com/broker/rest/domains/wsunmemfork765/members -d role=admin -d id=520aea2e421286619b000002 -X POST
<?xml version="1.0" encoding="UTF-8"?>
<response>
  <status>ok</status>
  <type>members</type>
  <data>
    <member>
      <type>user</type>
      <name>wsun+mem1@redhat.com</name>
      <id>520ae338421286ef7e000001</id>
      <role>admin</role>
      <explicit-role nil="true"></explicit-role>
      <from>
        <from>
          <type>owner</type>
          <role>admin</role>
        </from>
      </from>
      <owner>true</owner>
    </member>
   
    <member>
      <type>user</type>
      <name>wsun+mem3@redhat.com</name>
      <id>520aea2e421286619b000002</id>
      <role>admin</role>
      <explicit-role>admin</explicit-role>
      <owner>false</owner>
    </member>
  </data>
  <messages>
    <message>
      <severity>info</severity>
      <text>Added 1 member.</text>
      <exit-code>0</exit-code>
      <field nil="true"></field>
    </message>
  </messages>
  <version>1.6</version>
  
</response>
Comment 4 Wei Sun 2013-08-15 23:35:48 EDT
Tested this bug on devenv_3659,the bug still can be reproduced.
Comment 5 Clayton Coleman 2013-08-16 12:47:40 EDT
Try this with a user without '+' in the login attribute.  Probably a different bug if so.
Comment 6 Wei Sun 2013-08-18 22:57:24 EDT
Check this bug on devenv_3671.
Could add member successfully with a  user without '+' in the login attribute,but could not add member with a user with '+' in the login attribute.

Result:
[wsun@dhcp-8-229 ~]$ curl -k -H 'Accept: application/xml' -u wsun@redhat.com:changeme https://ec2-67-202-24-81.compute-1.amazonaws.com/broker/rest/domains/wsun3671/members -d role=view -d login=yujzhang@redhat.com -X POST

<?xml version="1.0" encoding="UTF-8"?>
<response>
  <status>ok</status>
  <type>members</type>
  <data>
    <member>
      <type>user</type>
      <name>wsun@redhat.com</name>
      <id>521186ad183b46471100003a</id>
      <role>admin</role>
      <explicit-role nil="true"></explicit-role>
      <from>
        <from>
          <type>owner</type>
          <role>admin</role>
        </from>
      </from>
      <owner>true</owner>
    </member>
    <member>
      <type>user</type>
      <name>yujzhang@redhat.com</name>
      <id>521186be183b46471100003c</id>
      <role>view</role>
      <explicit-role>view</explicit-role>
      <owner>false</owner>
    </member>
  </data>
  <messages>
    <message>
      <severity>info</severity>
      <text>Added 1 member.</text>
      <exit-code>0</exit-code>
      <field nil="true"></field>
    </message>
  </messages>
  <version>1.6</version>
  <api-version>1.6</api-version>
  <supported-api-versions>
    <supported-api-version>1.0</supported-api-version>
    <supported-api-version>1.1</supported-api-version>
    <supported-api-version>1.2</supported-api-version>
    <supported-api-version>1.3</supported-api-version>
    <supported-api-version>1.4</supported-api-version>
    <supported-api-version>1.5</supported-api-version>
    <supported-api-version>1.6</supported-api-version>
  </supported-api-versions>
</response>
[wsun@dhcp-8-229 ~]$ 
[wsun@dhcp-8-229 ~]$ curl -k -H 'Accept: application/xml' -u wsun@redhat.com:changeme https://ec2-67-202-24-81.compute-1.amazonaws.com/broker/rest/domains/wsun3671/members -d role=edit -d login=wsun+t1@redhat.com@redhat.com -X POST
<?xml version="1.0" encoding="UTF-8"?>
<response>
  <status>not_found</status>
  <type nil="true"></type>
  <data>
    <datum nil="true"></datum>
  </data>
  <messages>
    <message>
      <severity>error</severity>
      <text>The requested cloud user was not found.</text>
      <exit-code>1</exit-code>
      <field nil="true"></field>
    </message>
  </messages>
  <version>1.6</version>
  <api-version>1.6</api-version>
  <supported-api-versions>
    <supported-api-version>1.0</supported-api-version>
    <supported-api-version>1.1</supported-api-version>
    <supported-api-version>1.2</supported-api-version>
    <supported-api-version>1.3</supported-api-version>
    <supported-api-version>1.4</supported-api-version>
    <supported-api-version>1.5</supported-api-version>
    <supported-api-version>1.6</supported-api-version>
  </supported-api-versions>
</response>
Comment 7 Clayton Coleman 2013-08-19 14:50:13 EDT
The "+" is being encoded using URL encoding rules, which means it is turned into a space.  Use "%2B" from curl instead of "+" to try and submit those.
Comment 8 openshift-github-bot 2013-09-26 20:33:03 EDT
Commit pushed to master at https://github.com/openshift/origin-server

https://github.com/openshift/origin-server/commit/68f5ddf96b74a03175db3852e6405e8e8a92a9a5
Bug 995371 - Direct parameters to members were ignored

Members controller now accepts:
:members => [{:id, :role, :login}] as array of members
:member => {:id, :role, :login} as single member
:id, :role, :login => single member

Note You need to log in before you can comment on or make changes to this bug.