Mercurial > kallithea
diff rhodecode/controllers/api/api.py @ 3799:a732bbc40c7e beta
hide listing of default user
- there's no option to edit this user, so listing doesn't make sense
- listing and showing builtin default user is confusing
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Tue, 30 Apr 2013 15:32:04 +0200 |
parents | 12ca667b69b6 |
children | 2feb58495f34 |
line wrap: on
line diff
--- a/rhodecode/controllers/api/api.py Tue Apr 30 02:06:56 2013 +0200 +++ b/rhodecode/controllers/api/api.py Tue Apr 30 15:32:04 2013 +0200 @@ -41,8 +41,9 @@ from rhodecode.model.user import UserModel from rhodecode.model.users_group import UserGroupModel from rhodecode.model.db import Repository, RhodeCodeSetting, UserIpMap,\ - Permission + Permission, User from rhodecode.lib.compat import json +from rhodecode.lib.exceptions import DefaultUserException log = logging.getLogger(__name__) @@ -377,7 +378,10 @@ """ result = [] - for user in UserModel().get_all(): + users_list = User.query().order_by(User.username)\ + .filter(User.username != User.DEFAULT_USER)\ + .all() + for user in users_list: result.append(user.get_api_data()) return result @@ -477,6 +481,9 @@ msg='updated user ID:%s %s' % (user.user_id, user.username), user=user.get_api_data() ) + except DefaultUserException: + log.error(traceback.format_exc()) + raise JSONRPCError('editing default user is forbidden') except Exception: log.error(traceback.format_exc()) raise JSONRPCError('failed to update user `%s`' % userid)