Skip to content

Permissions

hypha.apply.funds.workflows.permissions

no_permissions module-attribute

no_permissions = make_permissions()

default_permissions module-attribute

default_permissions = make_permissions(edit=[staff_can], review=[staff_can])

hidden_from_applicant_permissions module-attribute

hidden_from_applicant_permissions = make_permissions(edit=[staff_can], review=[staff_can], view=[staff_can, reviewer_can])

reviewer_review_permissions module-attribute

reviewer_review_permissions = make_permissions(edit=[staff_can], review=[staff_can, reviewer_can])

community_review_permissions module-attribute

community_review_permissions = make_permissions(edit=[staff_can], review=[staff_can, reviewer_can, community_can])

applicant_edit_permissions module-attribute

applicant_edit_permissions = make_permissions(edit=[applicant_can, partner_can], review=[staff_can])

staff_edit_permissions module-attribute

staff_edit_permissions = make_permissions(edit=[staff_can])

Permissions

Permissions(permissions)
Source code in hypha/apply/funds/workflows/permissions.py
def __init__(self, permissions):
    self.permissions = permissions

permissions instance-attribute

permissions = permissions

can_do

can_do(user, action)
Source code in hypha/apply/funds/workflows/permissions.py
def can_do(self, user, action):
    checks = self.permissions.get(action, [])
    return any(check(user) for check in checks)

can_edit

can_edit(user)
Source code in hypha/apply/funds/workflows/permissions.py
def can_edit(self, user):
    return self.can_do(user, "edit")

can_review

can_review(user)
Source code in hypha/apply/funds/workflows/permissions.py
def can_review(self, user):
    return self.can_do(user, "review")

can_view

can_view(user)
Source code in hypha/apply/funds/workflows/permissions.py
def can_view(self, user):
    return self.can_do(user, "view")

staff_can

staff_can(user)
Source code in hypha/apply/funds/workflows/permissions.py
def staff_can(user):
    return user.is_apply_staff

applicant_can

applicant_can(user)
Source code in hypha/apply/funds/workflows/permissions.py
def applicant_can(user):
    return user.is_applicant

reviewer_can

reviewer_can(user)
Source code in hypha/apply/funds/workflows/permissions.py
def reviewer_can(user):
    return user.is_reviewer

partner_can

partner_can(user)
Source code in hypha/apply/funds/workflows/permissions.py
def partner_can(user):
    return user.is_partner

community_can

community_can(user)
Source code in hypha/apply/funds/workflows/permissions.py
def community_can(user):
    return user.is_community_reviewer

make_permissions

make_permissions(edit=None, review=None, view=None)
Source code in hypha/apply/funds/workflows/permissions.py
def make_permissions(edit=None, review=None, view=None):
    return {
        "edit": edit or [],
        "review": review or [],
        "view": view or [staff_can, applicant_can, reviewer_can, partner_can],
    }