def they_can_get_tilskuddsordninger(user, they): if is_administrator(user) or is_saksbehandler(user) or is_godkjenner(user): they.can(GET, 'Tilskuddsordning') elif is_soker(user): they.can(GET, 'Tilskuddsordning', if_tilskuddsordning_is_published)
def they_can_post_rapport(user, they): if is_soker(user): they.can(POST, 'Rapport', partial(if_rapport_owner_can_create_report, user=user))
def they_can_get_soknader(user, they): if is_saksbehandler(user) or is_godkjenner(user): they.can(GET, 'Soknad', partial(if_soknad_is_not_kladd)) elif is_soker(user): they.can(GET, 'Soknad', partial(if_soker_can_manage_soknad, user=user))
def they_can_post_soknader(user, they): if is_soker(user): they.can(POST, 'Soknad', partial(if_soknad_tilskuddsordning_is_published))
def if_soker_can_manage_soknad(soknad, user): user_can_manage_soknad = is_soker(user) \ and (is_person_member_of_organisation(soknad.organisation_id, user["person_id"]) or if_is_soknad_owner_and_no_organisation_is_registered(soknad, user)) return user_can_manage_soknad