Beispiel #1
0
 def delete_user(self, username, ext_id=0):
     user = User.by_name(username, False)
     if not user:
         raise UserError('User %s not found' % username)
     if ext_id:
         if user.external_id != ext_id:
             raise UserError('Invalid external id for user %s' % username)
     user.delete()
Beispiel #2
0
 def get_user(self, username):
     user = User.by_name(username, False)
     if not user:
         raise UserError('User %s not found' % username)
     return user
Beispiel #3
0
 def create_user(self, username, ext_id):
     exist = User.by_name(username, False)
     if exist:
         raise UserError('User %s already exist' % username)
     user = User.create(name=username, external_id=ext_id)
     return user.eid
Beispiel #4
0
 def _check_user(self, username):
     user = User.by_name(username, False)
     if not user:
         raise UserError('Invalid user %s' % username)
     return user