public function getPermissions()
    {
        if (!$this->permissions) {
            $type = property_exists($this, 'permissionsType')
                ? $this->permissionsType
                : str_replace('\\Entity\\', '/', static::class);
            $permissions = new Permissions($type);

            if (method_exists($this, 'setupPermissions')) {
                $this->setupPermissions($permissions);
            }

            $this->setPermissions($permissions);
        }

        return $this->permissions;
    }