cannot create user - 401 unauthoroized

Bug #843153 reported by klmitch
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
Fix Released
High
Unassigned

Bug Description

I'm doing a PUT to /v2.0/users as ADMIN

    eventlet.wsgi.server: DEBUG 127.0.0.1 - - [15/Jun/2011 14:42:11] "PUT /v2.0/users HTTP/1.1" 401 210 0.005239

But it fails with 401 Unauthorized.

Updating the code to print the request before creating

    @utils.wrap_error
    def create_user(self, req):
        print 'req %s' % req
        user = utils.get_normalized_request_content(users.User, req)
        print 'user %s' % user
        print 'user.tenant_id %s' % user.tenant_id
        return utils.send_result(201, req,
                       service.create_user(utils.get_auth_token(req), \
                                        user))

Shows that I'm tenant_id isn't being set:

    {"user": {"tenant_id": "1234", "password": "asdf", "enabled": true, "id": "jesse", "email": "<email address hidden>"}}
    user <keystone.logic.types.user.User object at 0x101e58bd0>
    user.tenant_id None

Looking at logic/service.py:

        dtenant = db_api.tenant_get(user.tenant_id)
        if dtenant == None:
            raise fault.UnauthorizedFault("Unauthorized")

Shows the exception.

Expected:

   A user is created with primary tenant of 1234

Actual:

   401 unauthorized

If the tenant is missing we should raise a BadRequestFault("Expecting a Tenant")?

        if not isinstance(user, users.User):
            raise fault.BadRequestFault("Expecting a User")

Revision history for this message
klmitch (q-noreply) wrote :

We allow users without tenants. That was based on the conversation we had that you did not want to have to create a dummy tenant to park global users in. So creating a user without a tenant is supported, so it isn't a bad request. However, there obviously is a bug somewhere that maybe is not validating that the caller has the right to create a global user (a user without a tenant). I can add that test case...

Revision history for this message
klmitch (q-noreply) wrote :

Creating with a PUT works since you are sending an ID ...

thx

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.