public function getPermissionsForPrincipal($principalId)
    {
        if (empty($principalId)) {
            throw new IllegalStateException('Principal ID must be set!');
        }

        $currentAcl = $this->getAcl();

        if ($currentAcl === null) {
            throw new IllegalStateException('ACLs are not available');
        }

        $result = [];

        foreach ($currentAcl->getAces() as $ace) {
            if ($principalId === $ace->getPrincipalId() && count($ace->getPermissions()) > 0) {
                $result = array_merge($result, $ace->getPermissions());
            }
        }

        return $result;
    }