Changeset 2052 in main


Ignore:
Timestamp:
01/21/13 13:54:06 (7 years ago)
Author:
pcosquer
Message:

ecr: fix browse ecr with restricted accounts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/openPLM/apps/ecr/views.py

    r1929 r2052  
    2222 
    2323 
    24 @bv.secure_required 
     24@bv.handle_errors(restricted_access=False) 
    2525def browse_ecr(request): 
    2626    user = request.user 
    27     if user.is_authenticated() and not user.get_profile().restricted: 
     27    if not user.get_profile().restricted: 
    2828        # only authenticated users can see all groups and users 
    2929        obj, ctx = bv.get_generic_data(request, search=False) 
     
    4444            'navigation_history': [], 
    4545        }) 
    46         query = Q(published=True) 
    47         if user.is_authenticated(): 
    48             readable = user.ecruserlink_user.now().filter(role=models.ROLE_READER) 
    49             readable |= user.ecruserlink_user.now().filter(role=models.ROLE_OWNER) 
    50             query |= Q(id__in=readable.values_list("ecr_id", flat=True)) 
    51         object_list = ECR.objects.filter(query) 
     46        readable = user.ecrs.now().filter(role=models.ROLE_READER) 
     47        readable |= user.ecrs.now().filter(role=models.ROLE_OWNER) 
     48        object_list = ECR.objects.filter(id__in=readable) 
    5249 
    5350    ctx.update(get_pagination(request.GET, object_list, "ECR")) 
Note: See TracChangeset for help on using the changeset viewer.