def show_in_navigation(cls, domain=None, project=None, user=None): if domain and project and user is None: return True if user and (is_succeed_admin(user) or has_any_role(user)): return True return False
def options(self): user = self.request.couch_user cm = dict(val=CONFIG['cm_role'], text=ugettext_noop("Care Manager")) chw = dict(val=CONFIG['chw_role'], text=ugettext_noop("Community Health Worker")) options = [] if isinstance(user, WebUser) or is_succeed_admin(user) or is_pm_or_pi(user): options = [ dict(val='', text=ugettext_noop("All Roles")), dict(val=CONFIG['pm_role'], text=ugettext_noop("Project Manager")), cm, chw ] else: role = user.user_data['role'] if role == CONFIG['cm_role']: options.append(cm) self.selected = cm['val'] elif role == CONFIG['chw_role']: options.append(chw) self.selected = chw['val'] return options