protected function checkEntitlement($entitlement_value)
    {
        if ($entitlement_value == 'permitAll') {
            return true;
        }
        if ($entitlement_value == 'denyAll') {
            return false;
        }

        // The user has more than one EduPersonEntitlement.
        if (is_array($this->entitlements)) {
            return (in_array($entitlement_value, $this->entitlements));
            // User only has one EduPersonEntitlement.
        } else {
            return ($entitlement_value == $this->entitlements);
        }
    }