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

All Samples(8)  |  Call(8)  |  Derive(0)  |  Import(0)

src/c/o/commcare-hq-HEAD/corehq/apps/accounting/forms.py   commcare-hq(Download)
    def available_privileges(self):
        for priv in privileges.MAX_PRIVILEGES:
            role = Role.objects.get(slug=priv)
            yield (role.slug, role.name)
 
            to_role__slug__in=privileges.MAX_PRIVILEGES).values('from_role').distinct()])
        roles = roles.union(grant_roles)
        roles = [Role.objects.get(pk=r) for r in roles]
        for role in roles:
            yield {
            )
            for privilege in self.cleaned_data['privileges']:
                privilege = Role.objects.get(slug=privilege)
                Grant.objects.create(
                    from_role=role,
                    to_role=privilege,
                )
        else:
            role = Role.objects.get(slug=self.cleaned_data['role_slug'])

src/c/o/commcare-hq-HEAD/corehq/apps/hqadmin/management/commands/cchq_prbac_bootstrap.py   commcare-hq(Download)
                logger.info('[DRY RUN] Granting privilege: %s => %s', grantee_slug, priv_slug)
        else:
            grantee = Role.objects.get(slug=grantee_slug)
            priv = Role.objects.get(slug=priv_slug)
 

src/c/o/commcare-hq-HEAD/corehq/apps/accounting/management/commands/cchq_software_plan_bootstrap.py   commcare-hq(Download)
                role_slug = self.BOOTSTRAP_EDITION_TO_ROLE[edition]
                try:
                    role = Role.objects.get(slug=role_slug)
                except ObjectDoesNotExist:
                    logger.info("Could not find the role '%s'. Did you forget to run cchq_prbac_bootstrap?")

src/c/o/commcare-hq-HEAD/corehq/apps/domain/middleware.py   commcare-hq(Download)
                pass
        try:
            request.role = Role.objects.get(slug='community_plan_v0')
        except Role.DoesNotExist:
            request.role = Role()  # A fresh Role() has no privileges