class InviteOrganisationPermissionRules extends BasePermissionRules {

    @PermissionRule(value = "READ_FOR_UPDATE", description = "a consortium member can view the invites of their own organisation or if lead applicant")
    public boolean consortiumCanViewAnInviteOrganisation(InviteOrganisationResource inviteOrganisation, UserResource user) {
        if (inviteOrganisation.getOrganisation() == null) {
            // Organisation is not confirmed yet so only the lead can view it. There are no other users that are collaborators for this organisation
            return isLeadApplicantForAllApplications(inviteOrganisation, user);
        }
        return isApplicationCollaboratorForOrganisationOrIsLeadApplicant(inviteOrganisation, user);
    }

}