コード例 #1
0
ファイル: nfp_nrc.py プロジェクト: eea/eea.ldapadmin
def logged_in_user(request):
    user_id = ''
    if _is_authenticated(request):
        user = request.get('AUTHENTICATED_USER', '')
        user_id = user.id

    return user_id
コード例 #2
0
def logged_in_user(request):
    user_id = ''
    if _is_authenticated(request):
        user = request.get('AUTHENTICATED_USER', '')
        user_id = user.id

    return user_id
コード例 #3
0
    def nrcs(self, REQUEST):
        """ view nrcs and members in these roles """

        if not _is_authenticated(REQUEST):
            pass

        country_code = REQUEST.form.get("nfp")
        country_name = code_to_name(country_code)
        agent = self._get_ldap_agent()

        if not self._allowed(agent, REQUEST, country_code):
            return None

        roles = get_members(agent, country_code, 'eionet-nrc')
        has_problematic_users = False

        for role in roles:
            for user in role.users:
                if not user['ldap_org']:
                    has_problematic_users = True
                    break

        if has_problematic_users:
            msg = "There are problematic users with regards to their "\
                  "connection to a national organisation"
            _set_session_message(REQUEST, 'info', msg)

        options = {'roles': roles,
                   'country': country_code,
                   'country_name': country_name or country_code,
                   # naming is similar to all NRC roles
                   'naming': roles_leaders.naming(roles[0].role_id),
                   }
        self._set_breadcrumbs([("Browsing NRC-s in %s" % country_name, '#')])
        return self._render_template('zpt/nfp_nrc/nrcs.zpt', **options)
コード例 #4
0
 def index_html(self, REQUEST):
     """ view """
     if not _is_authenticated(REQUEST):
         return self._render_template('zpt/nfp_nrc/index.zpt')
     agent = self._get_ldap_agent()
     user_id = logged_in_user(REQUEST)
     nfps = get_nfp_roles(agent, user_id)
     options = {'nfps': nfps}
     return self._render_template('zpt/nfp_nrc/index.zpt', **options)
コード例 #5
0
ファイル: nfp_nrc.py プロジェクト: eea/eea.ldapadmin
 def index_html(self, REQUEST):
     """ view """
     if not _is_authenticated(REQUEST):
         return self._render_template('zpt/nfp_nrc/index.zpt')
     agent = self._get_ldap_agent()
     user_id = logged_in_user(REQUEST)
     nfps = get_nfp_roles(agent, user_id)
     options = {'nfps': nfps}
     return self._render_template('zpt/nfp_nrc/index.zpt', **options)
コード例 #6
0
ファイル: nfp_nrc.py プロジェクト: eea/eea.ldapadmin
    def awps(self, REQUEST):
        """ view awp roles and members in these roles """

        if not _is_authenticated(REQUEST):
            pass

        country_code = REQUEST.form.get("nfp", 'eea')
        country_name = code_to_name(country_code)
        agent = self._get_ldap_agent()

        if not self._allowed(agent, REQUEST, country_code):
            return None

        roles = get_members(agent, country_code, 'reportnet-awp')

        options = {'roles': roles,
                   'country': country_code,
                   'country_name': country_name or country_code,
                   }
        self._set_breadcrumbs([("Browsing reporter roles in %s" % country_name,
                                '#')])
        return self._render_template('zpt/nfp_nrc/awps.zpt', **options)
コード例 #7
0
ファイル: nfp_nrc.py プロジェクト: eea/eea.ldapadmin
    def nrcs(self, REQUEST):
        """ view nrcs and members in these roles """

        if not _is_authenticated(REQUEST):
            pass

        country_code = REQUEST.form.get("nfp")
        country_name = code_to_name(country_code)
        agent = self._get_ldap_agent()

        if not self._allowed(agent, REQUEST, country_code):
            return None

        top_role_dns = get_top_role_dns(agent, 'eionet-nrc')

        options = {'top_role_dns': top_role_dns,
                   'country': country_code,
                   'agent': agent,
                   'country_name': country_name or country_code,
                   }
        self._set_breadcrumbs([("Browsing NRC-s in %s" % country_name, '#')])
        return self._render_template('zpt/nfp_nrc/nrcs.zpt', **options)
コード例 #8
0
    def awps(self, REQUEST):
        """ view awp roles and members in these roles """

        if not _is_authenticated(REQUEST):
            pass

        country_code = REQUEST.form.get("nfp", 'eea')
        country_name = code_to_name(country_code)
        agent = self._get_ldap_agent()

        if not self._allowed(agent, REQUEST, country_code):
            return None

        roles = get_members(agent, country_code, 'reportnet-awp')

        options = {
            'roles': roles,
            'country': country_code,
            'country_name': country_name or country_code,
        }
        self._set_breadcrumbs([("Browsing reporter roles in %s" % country_name,
                                '#')])
        return self._render_template('zpt/nfp_nrc/awps.zpt', **options)
コード例 #9
0
    def nrcs(self, REQUEST):
        """ view nrcs and members in these roles """

        if not _is_authenticated(REQUEST):
            pass

        country_code = REQUEST.form.get("nfp")
        country_name = code_to_name(country_code)
        agent = self._get_ldap_agent()

        if not self._allowed(agent, REQUEST, country_code):
            return None

        top_role_dns = get_top_role_dns(agent, 'eionet-nrc')

        options = {
            'top_role_dns': top_role_dns,
            'country': country_code,
            'agent': agent,
            'country_name': country_name or country_code,
        }
        self._set_breadcrumbs([("Browsing NRC-s in %s" % country_name, '#')])
        return self._render_template('zpt/nfp_nrc/nrcs.zpt', **options)