freeipa / freeipa-community-portal

[ABANDONED] FreeIPA Community Portal extension
GNU General Public License v3.0
4 stars 6 forks source link

NotFound: username: stage user not found #10

Open tiran opened 8 years ago

tiran commented 8 years ago

I get a "stage user not found" error when the user already exists as an ordinary user. Perhaps the user model should check if the user already exists and print an error message.

Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/cherrypy/_cprequest.py", line 670, in respond
    response.body = self.handler()
  File "/usr/lib/python2.7/site-packages/cherrypy/lib/encoding.py", line 217, in __call__
    self.body = self.oldhandler(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/cherrypy/_cpdispatch.py", line 61, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/srv/freeipa-community-portal/lib/python2.7/site-packages/freeipa_community_portal/app.py", line 66, in POST
    errors = user.save()
  File "/srv/freeipa-community-portal/lib/python2.7/site-packages/freeipa_community_portal/model/user.py", line 55, in save
    self._call_api()
  File "/srv/freeipa-community-portal/lib/python2.7/site-packages/freeipa_community_portal/model/user.py", line 69, in _call_api
    mail=self.email
  File "/usr/lib/python2.7/site-packages/ipalib/frontend.py", line 443, in __call__
    ret = self.run(*args, **options)
  File "/usr/lib/python2.7/site-packages/ipalib/frontend.py", line 761, in run
    return self.forward(*args, **options)
  File "/usr/lib/python2.7/site-packages/ipalib/frontend.py", line 782, in forward
    return self.Backend.rpcclient.forward(self.name, *args, **kw)
  File "/usr/lib/python2.7/site-packages/ipalib/rpc.py", line 888, in forward
    return self._call_command(command, params)
  File "/usr/lib/python2.7/site-packages/ipalib/rpc.py", line 865, in _call_command
    return command(*params)
  File "/usr/lib/python2.7/site-packages/ipalib/rpc.py", line 1016, in _call
    return self.__request(name, args)
  File "/usr/lib/python2.7/site-packages/ipalib/rpc.py", line 1010, in __request
    raise error_class(message=error['message'])
NotFound: username: stage user not found
tiran commented 8 years ago

Correction: I ALWAYS get a NotFound error.

To add extra fun: the stage user 'username' is created although I already have a normal user by that name. FreeIPA doesn't prevent name clashes.

tiran commented 8 years ago

This bug is really two bugs. First of all the portal also needs "System: Read Stage Users". Secondly stage user and normal user don't conflict. The portal should check the normal users to make sure that a stage user doesn't conflict with an ordinary user.

tiran commented 8 years ago

The NotFound exception is gone. The portal also needs 'System: Read Stage User' permission. The requirements is documented and added by create-portal-user.