(
        authenticated_user_id: int, project_id: int
    )
return is_admin or is_author or is_org_manager or is_manager_team
Is user action permitted on project
Is user action permitted on project
Is user action permitted on project
def is_user_action_permitted_on_project(
        authenticated_user_id: int, project_id: int
    ) -> bool:
        """ Is user action permitted on project"""
        project = Project.get(project_id)
        author_id = project.author_id
        allowed_roles = [TeamRoles.PROJECT_MANAGER.value]

        is_admin = UserService.is_user_an_admin(authenticated_user_id)
        is_author = UserService.is_user_the_project_author(
            authenticated_user_id, author_id
        )
        is_org_manager = False
        is_manager_team = False
        if not (is_admin or is_author):
            if hasattr(project, "organisation_id") and project.organisation_id:
                org_id = project.organisation_id
                is_org_manager = OrganisationService.is_user_an_org_manager(
                    org_id, authenticated_user_id
                )
                if not is_org_manager:
                    is_manager_team = TeamService.check_team_membership(
                        project_id, allowed_roles, authenticated_user_id
                    )

        return is_admin or is_author or is_org_manager or is_manager_team
def is_user_action_permitted_on_project ( authenticated_user_id : int , project_id : int ) -> bool : project = Project . get ( project_id ) author_id = project . author_id allowed_roles = [ TeamRoles . PROJECT_MANAGER . value ] is_admin = UserService . is_user_an_admin ( authenticated_user_id ) is_author = UserService . is_user_the_project_author ( authenticated_user_id , author_id ) is_org_manager = False is_manager_team = False if not ( is_admin or is_author ) : if hasattr ( project , "organisation_id" ) and project . organisation_id : org_id = project . organisation_id is_org_manager = OrganisationService . is_user_an_org_manager ( org_id , authenticated_user_id ) if not is_org_manager : is_manager_team = TeamService . check_team_membership ( project_id , allowed_roles , authenticated_user_id ) return is_admin or is_author or is_org_manager or is_manager_team