Show More
@@ -30,19 +30,18 b' from pylons_app.model import meta' | |||
|
30 | 30 | from pylons_app.model.db import User, RepoToPerm, Repository, Permission |
|
31 | 31 | from sqlalchemy.exc import OperationalError |
|
32 | 32 | from sqlalchemy.orm.exc import NoResultFound, MultipleResultsFound |
|
33 | import crypt | |
|
33 | import hashlib | |
|
34 | 34 | from decorator import decorator |
|
35 | 35 | import logging |
|
36 | 36 | |
|
37 | 37 | log = logging.getLogger(__name__) |
|
38 | 38 | |
|
39 | 39 | def get_crypt_password(password): |
|
40 | """ | |
|
41 | Cryptographic function used for password hashing | |
|
40 | """Cryptographic function used for password hashing based on sha1 | |
|
42 | 41 | @param password: password to hash |
|
43 | 42 | """ |
|
44 | return crypt.crypt(password, '6a') | |
|
45 | ||
|
43 | hashed = hashlib.sha1(password).hexdigest() | |
|
44 | return hashed[3:] + hashed[:3] | |
|
46 | 45 | |
|
47 | 46 | @cache_region('super_short_term', 'cached_user') |
|
48 | 47 | def get_user_cached(username): |
@@ -151,6 +150,8 b' def fill_perms(user):' | |||
|
151 | 150 | |
|
152 | 151 | else: |
|
153 | 152 | user.permissions['global'].add('repository.create') |
|
153 | user.permissions['global'].add('hg.register') | |
|
154 | ||
|
154 | 155 | for perm in default_perms: |
|
155 | 156 | if perm.Repository.private and not perm.Repository.user_id == user.user_id: |
|
156 | 157 | #disable defaults for private repos, |
@@ -187,7 +188,7 b' def get_user(session):' | |||
|
187 | 188 | user = session.get('hg_app_user', AuthUser()) |
|
188 | 189 | if user.is_authenticated: |
|
189 | 190 | user = fill_data(user) |
|
190 |
|
|
|
191 | user = fill_perms(user) | |
|
191 | 192 | session['hg_app_user'] = user |
|
192 | 193 | session.save() |
|
193 | 194 | return user |
General Comments 0
You need to be logged in to leave comments.
Login now