|
5 | 5 | # Copyright 2018 by it's authors.
|
6 | 6 | # Some rights reserved. See LICENSE.rst, CONTRIBUTORS.rst.
|
7 | 7 |
|
8 |
| -from Products.CMFCore.utils import getToolByName |
| 8 | +from collections import OrderedDict |
9 | 9 |
|
| 10 | +from Products.CMFCore.utils import getToolByName |
10 | 11 | from bika.health import bikaMessageFactory as _
|
11 | 12 | from bika.health.permissions import *
|
12 | 13 | from bika.lims import api
|
13 | 14 | from bika.lims.browser.client import ClientContactsView
|
14 |
| -from bika.lims.interfaces import IClient, ILabContact |
| 15 | +from bika.lims.interfaces import IClient |
15 | 16 | from bika.lims.utils import get_link
|
16 | 17 | from plone.memoize import view as viewcache
|
17 |
| -from collections import OrderedDict |
| 18 | + |
18 | 19 |
|
19 | 20 | class DoctorsView(ClientContactsView):
|
20 | 21 |
|
@@ -87,20 +88,10 @@ def __call__(self):
|
87 | 88 | def get_user_client_uid(self, default=None):
|
88 | 89 | """Returns the id of the client the current user belongs to
|
89 | 90 | """
|
90 |
| - user = api.get_current_user() |
91 |
| - roles = user.getRoles() |
92 |
| - if 'Client' not in roles: |
93 |
| - return default |
94 |
| - |
95 |
| - contact = api.get_user_contact(user) |
96 |
| - if not contact or ILabContact.providedBy(contact): |
97 |
| - return default |
98 |
| - |
99 |
| - client = api.get_parent(contact) |
100 |
| - if not client or not IClient.providedBy(client): |
101 |
| - return default |
102 |
| - |
103 |
| - return api.get_uid(client) |
| 91 | + client = api.get_current_client() |
| 92 | + if client: |
| 93 | + return api.get_uid(client) |
| 94 | + return default |
104 | 95 |
|
105 | 96 | def folderitem(self, obj, item, index):
|
106 | 97 | """Applies new properties to the item to be rendered
|
|
0 commit comments