Mercurial > kallithea
comparison kallithea/model/user.py @ 4197:d208416c84c6 kallithea-2.2.5-rebrand
Rename rhodecode_user to authuser - it is an AuthUser instance
author | Bradley M. Kuhn <bkuhn@sfconservancy.org> |
---|---|
date | Wed, 02 Jul 2014 19:05:10 -0400 |
parents | d1addaf7a91e |
children | ad38f9f93b3b |
comparison
equal
deleted
inserted
replaced
4196:06e49be38d78 | 4197:d208416c84c6 |
---|---|
30 from pylons.i18n.translation import _ | 30 from pylons.i18n.translation import _ |
31 | 31 |
32 from sqlalchemy.exc import DatabaseError | 32 from sqlalchemy.exc import DatabaseError |
33 | 33 |
34 | 34 |
35 from kallithea.lib.utils2 import safe_unicode, generate_api_key, get_current_rhodecode_user | 35 from kallithea.lib.utils2 import safe_unicode, generate_api_key, get_current_authuser |
36 from kallithea.lib.caching_query import FromCache | 36 from kallithea.lib.caching_query import FromCache |
37 from kallithea.model import BaseModel | 37 from kallithea.model import BaseModel |
38 from kallithea.model.db import User, UserToPerm, Notification, \ | 38 from kallithea.model.db import User, UserToPerm, Notification, \ |
39 UserEmailMap, UserIpMap | 39 UserEmailMap, UserIpMap |
40 from kallithea.lib.exceptions import DefaultUserException, \ | 40 from kallithea.lib.exceptions import DefaultUserException, \ |
76 def get_by_api_key(self, api_key, cache=False): | 76 def get_by_api_key(self, api_key, cache=False): |
77 return User.get_by_api_key(api_key, cache) | 77 return User.get_by_api_key(api_key, cache) |
78 | 78 |
79 def create(self, form_data, cur_user=None): | 79 def create(self, form_data, cur_user=None): |
80 if not cur_user: | 80 if not cur_user: |
81 cur_user = getattr(get_current_rhodecode_user(), 'username', None) | 81 cur_user = getattr(get_current_authuser(), 'username', None) |
82 | 82 |
83 from kallithea.lib.hooks import log_create_user, check_allowed_create_user | 83 from kallithea.lib.hooks import log_create_user, check_allowed_create_user |
84 _fd = form_data | 84 _fd = form_data |
85 user_data = { | 85 user_data = { |
86 'username': _fd['username'], 'password': _fd['password'], | 86 'username': _fd['username'], 'password': _fd['password'], |
125 :param extern_name: | 125 :param extern_name: |
126 :param extern_type: | 126 :param extern_type: |
127 :param cur_user: | 127 :param cur_user: |
128 """ | 128 """ |
129 if not cur_user: | 129 if not cur_user: |
130 cur_user = getattr(get_current_rhodecode_user(), 'username', None) | 130 cur_user = getattr(get_current_authuser(), 'username', None) |
131 | 131 |
132 from kallithea.lib.auth import get_crypt_password, check_password | 132 from kallithea.lib.auth import get_crypt_password, check_password |
133 from kallithea.lib.hooks import log_create_user, check_allowed_create_user | 133 from kallithea.lib.hooks import log_create_user, check_allowed_create_user |
134 user_data = { | 134 user_data = { |
135 'username': username, 'password': password, | 135 'username': username, 'password': password, |
257 log.error(traceback.format_exc()) | 257 log.error(traceback.format_exc()) |
258 raise | 258 raise |
259 | 259 |
260 def delete(self, user, cur_user=None): | 260 def delete(self, user, cur_user=None): |
261 if not cur_user: | 261 if not cur_user: |
262 cur_user = getattr(get_current_rhodecode_user(), 'username', None) | 262 cur_user = getattr(get_current_authuser(), 'username', None) |
263 user = self._get_user(user) | 263 user = self._get_user(user) |
264 | 264 |
265 try: | 265 try: |
266 if user.username == User.DEFAULT_USER: | 266 if user.username == User.DEFAULT_USER: |
267 raise DefaultUserException( | 267 raise DefaultUserException( |