Skip to content

Commit

Permalink
[FIX] apply same visibility rules as base
Browse files Browse the repository at this point in the history
  • Loading branch information
odony committed Apr 10, 2015
1 parent d0493ee commit 8d750ec
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions addons/auth_crypt/auth_crypt.py
Expand Up @@ -5,6 +5,8 @@
import openerp
from openerp.osv import fields, osv

openerp.addons.base.res.res_users.USER_PRIVATE_FIELDS.append('password_crypt')

_logger = logging.getLogger(__name__)

default_crypt_context = CryptContext(
Expand Down
9 changes: 7 additions & 2 deletions openerp/addons/base/res/res_users.py
Expand Up @@ -37,6 +37,9 @@

_logger = logging.getLogger(__name__)

# Only users who can modify the user (incl. the user herself) see the real contents of these fields
USER_PRIVATE_FIELDS = ['password']

#----------------------------------------------------------
# Basic res.groups and res.users
#----------------------------------------------------------
Expand Down Expand Up @@ -280,8 +283,10 @@ def _get_default_image(self, cr, uid, context=None):

def read(self, cr, uid, ids, fields=None, context=None, load='_classic_read'):
def override_password(o):
if 'password' in o and ('id' not in o or o['id'] != uid):
o['password'] = '********'
if ('id' not in o or o['id'] != uid):
for f in USER_PRIVATE_FIELDS:
if f in o:
o[f] = '********'
return o

if fields and (ids == [uid] or ids == uid):
Expand Down

0 comments on commit 8d750ec

Please sign in to comment.