diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b7e75e78..403f2a2f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -87,7 +87,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '7.2' + php-version: '7.4' extensions: mbstring, intl, apcu tools: cs2pr coverage: none diff --git a/.github/workflows/deploy_docs.yml b/.github/workflows/deploy_docs.yml new file mode 100644 index 00000000..34785a42 --- /dev/null +++ b/.github/workflows/deploy_docs.yml @@ -0,0 +1,22 @@ +--- +name: 'deploy_docs' + +on: + push: + branches: + - master + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Cloning repo + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Push to dokku + uses: dokku/github-action@master + with: + git_remote_url: 'ssh://dokku@apps.cakephp.org:authorization-docs-2' + ssh_private_key: ${{ secrets.DOKKU_SSH_PRIVATE_KEY }} diff --git a/docs.Dockerfile b/docs.Dockerfile index be8118fa..1bab7307 100644 --- a/docs.Dockerfile +++ b/docs.Dockerfile @@ -3,18 +3,36 @@ FROM markstory/cakephp-docs-builder as builder COPY docs /data/docs +ENV LANGS="en es fr" + # Build docs with sphinx RUN cd /data/docs-builder && \ - make website LANGS="en es fr" SOURCE=/data/docs DEST=/data/website + make website LANGS="$LANGS" SOURCE=/data/docs DEST=/data/website # Build a small nginx container with just the static site in it. FROM nginx:1.15-alpine +# Configure search index script +ENV LANGS="en es fr" +ENV SEARCH_SOURCE="/data/docs" +ENV SEARCH_URL_PREFIX="/authorization/2" + +# Janky but we could extract this into an image we re-use. +RUN apk add --update php php-curl + COPY --from=builder /data/website /data/website COPY --from=builder /data/docs-builder/nginx.conf /etc/nginx/conf.d/default.conf +# Copy the search index script, and source files over. +COPY --from=builder /data/docs-builder/scripts/populate_search_index.php /data/populate_search_index.php +COPY --from=builder /data/docs /data/docs + +COPY run.sh /data/run.sh + # Move files into final location RUN cp -R /data/website/html/* /usr/share/nginx/html \ && rm -rf /data/website/ RUN ln -s /usr/share/nginx/html /usr/share/nginx/html/2.x + +CMD ["/data/run.sh"] diff --git a/docs/es/contents.rst b/docs/es/contents.rst new file mode 100644 index 00000000..0938d2e8 --- /dev/null +++ b/docs/es/contents.rst @@ -0,0 +1,15 @@ +Contents +######## + +.. toctree:: + :maxdepth: 2 + :caption: CakePHP Authorization + + /index + /policies +.. /policy-resolvers +.. /middleware +.. /checking-authorization +.. /component +.. /request-authorization-middleware +.. /2-0-migration-guie diff --git a/docs/es/index.rst b/docs/es/index.rst index e8bf65d3..8f21c4db 100644 --- a/docs/es/index.rst +++ b/docs/es/index.rst @@ -79,8 +79,9 @@ Otras lecturas ============== * :doc:`/policies` -* :doc:`/policy-resolvers` -* :doc:`/middleware` -* :doc:`/component` -* :doc:`/checking-authorization` -* :doc:`/request-authorization-middleware` + +.. * :doc:`/policy-resolvers` +.. * :doc:`/middleware` +.. * :doc:`/component` +.. * :doc:`/checking-authorization` +.. * :doc:`/request-authorization-middleware` diff --git a/psalm-baseline.xml b/psalm-baseline.xml new file mode 100644 index 00000000..732ee67a --- /dev/null +++ b/psalm-baseline.xml @@ -0,0 +1,8 @@ + + + + + loadModel + + + diff --git a/psalm.xml b/psalm.xml index d3b0c253..2b5eec79 100644 --- a/psalm.xml +++ b/psalm.xml @@ -5,6 +5,8 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://getpsalm.org/schema/config" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" + errorBaseline="psalm-baseline.xml" + autoloader="tests/bootstrap.php" > diff --git a/run.sh b/run.sh new file mode 100755 index 00000000..03f2b59a --- /dev/null +++ b/run.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +# Update elasticsearch indexes. +for lang in ${LANGS} +do + php /data/populate_search_index.php --source="$SEARCH_SOURCE/$*" --lang="$lang" --host="dokku-elasticsearch-searchv2" --url-prefix="$SEARCH_URL_PREFIX" +done + +# Run nginx like normal. +nginx -g daemon off; diff --git a/src/Controller/Component/AuthorizationComponent.php b/src/Controller/Component/AuthorizationComponent.php index 99dd23f9..6e33506d 100644 --- a/src/Controller/Component/AuthorizationComponent.php +++ b/src/Controller/Component/AuthorizationComponent.php @@ -340,7 +340,7 @@ protected function getDefaultAction(ServerRequest $request): string /** * Returns model authorization handler if model authorization is enabled. * - * @return array + * @return array */ public function implementedEvents(): array {