Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(23)  |  Call(5)  |  Derive(0)  |  Import(18)

src/c/o/commcare-hq-HEAD/corehq/apps/app_manager/models.py   commcare-hq(Download)
from couchdbkit.resource import ResourceNotFound
from corehq import toggles, privileges
from django_prbac.exceptions import PermissionDenied
from corehq.apps.accounting.utils import domain_has_privilege
 
    def validate_fixtures(self):
        if not domain_has_privilege(self.domain, privileges.LOOKUP_TABLES):
            for form in self.get_forms():
                if form.has_fixtures:
                    raise PermissionDenied(_(

src/d/j/django-prbac-0.0.2/django_prbac/decorators.py   django-prbac(Download)
# Use modern Python
from __future__ import unicode_literals, absolute_import, print_function
 
# Local Imports
from django_prbac.exceptions import PermissionDenied
        def wrapped(request, *args, **kwargs):
 
            if not hasattr(request, 'role'):
                raise PermissionDenied()
 
            roles = Role.objects.filter(slug=slug)
            if not roles:
                raise PermissionDenied()
            privilege = roles[0].instantiate(assignment)
            if not request.role.has_privilege(privilege):
                raise PermissionDenied()
 
            return fn(request, *args, **kwargs)

src/c/o/commcare-hq-HEAD/corehq/apps/reports/dispatcher.py   commcare-hq(Download)
from corehq.apps.domain.decorators import login_and_domain_required, cls_to_view
from dimagi.utils.decorators.datespan import datespan_in_request
from django_prbac.exceptions import PermissionDenied
from django_prbac.utils import ensure_request_has_privilege
 
            return self.dispatch_with_priv(request, *args, **kwargs)
        if not domain_has_privilege(request.domain, privileges.CUSTOM_REPORTS):
            raise PermissionDenied()
        return super(CustomProjectReportDispatcher, self).dispatch(request, *args, **kwargs)
 

src/c/o/commcare-hq-HEAD/corehq/apps/users/views/mobile/users.py   commcare-hq(Download)
from dimagi.utils.excel import WorkbookJSONReader, WorksheetNotFound, JSONReaderError, HeaderValueError
from corehq.apps.commtrack.models import CommTrackUser
from django_prbac.exceptions import PermissionDenied
from django_prbac.utils import ensure_request_has_privilege
from soil.util import get_download_context, expose_download

src/c/o/commcare-hq-HEAD/corehq/apps/users/views/__init__.py   commcare-hq(Download)
from corehq.apps.users.decorators import require_can_edit_web_users, require_permission_to_edit_user
from dimagi.utils.decorators.memoized import memoized
from django_prbac.exceptions import PermissionDenied
from django_prbac.utils import ensure_request_has_privilege
import langcodes

src/c/o/commcare-hq-HEAD/corehq/apps/reports/standard/export.py   commcare-hq(Download)
from django.utils.translation import ugettext_noop, ugettext_lazy
from django.http import Http404
from django_prbac.exceptions import PermissionDenied
from django_prbac.utils import ensure_request_has_privilege
from corehq import privileges

src/c/o/commcare-hq-HEAD/corehq/apps/users/util.py   commcare-hq(Download)
from dimagi.utils.couch.database import get_db
from django.core.cache import cache
from django_prbac.exceptions import PermissionDenied
from django_prbac.utils import ensure_request_has_privilege
 

src/c/o/commcare-hq-HEAD/corehq/apps/reports/models.py   commcare-hq(Download)
from dimagi.utils.logging import notify_exception
from dimagi.utils.web import get_url_base
from django_prbac.exceptions import PermissionDenied
 
 

src/c/o/commcare-hq-HEAD/corehq/apps/reminders/util.py   commcare-hq(Download)
from corehq.apps.users.models import CommCareUser
from casexml.apps.case.models import CommCareCase, CommCareCaseGroup
from django_prbac.exceptions import PermissionDenied
from django_prbac.utils import ensure_request_has_privilege
 

src/c/o/commcare-hq-HEAD/corehq/apps/hqwebapp/models.py   commcare-hq(Download)
from corehq.apps.indicators.utils import get_indicator_domains
from corehq.apps.reminders.util import can_use_survey_reminders
from django_prbac.exceptions import PermissionDenied
from django_prbac.models import Role, UserRole
from django_prbac.utils import ensure_request_has_privilege

  1 | 2  Next