From bb399bc9e47b7442c8d2aab827aab181f772d4e0 Mon Sep 17 00:00:00 2001 From: Torin Sandall Date: Thu, 11 May 2017 07:30:58 -0700 Subject: [PATCH] Rename examples to tutorials --- site/_includes/nav-examples.html | 32 ----------------- site/_includes/nav-main.html | 12 +++---- site/_includes/nav-tutorials.html | 34 +++++++++++++++++++ .../{examples.html => tutorials.html} | 2 +- .../docker-authorization/index.md | 24 ++++++------- .../http-api-authorization/index.md | 18 +++++----- .../ssh-sudo-authorization/index.md | 24 ++++++------- .../working-with-the-opa-repl/index.md | 14 ++++---- 8 files changed, 81 insertions(+), 79 deletions(-) delete mode 100644 site/_includes/nav-examples.html create mode 100644 site/_includes/nav-tutorials.html rename site/_layouts/{examples.html => tutorials.html} (93%) rename site/{examples => tutorials}/docker-authorization/index.md (93%) rename site/{examples => tutorials}/http-api-authorization/index.md (90%) rename site/{examples => tutorials}/ssh-sudo-authorization/index.md (91%) rename site/{examples => tutorials}/working-with-the-opa-repl/index.md (93%) diff --git a/site/_includes/nav-examples.html b/site/_includes/nav-examples.html deleted file mode 100644 index d1eceaa6dd..0000000000 --- a/site/_includes/nav-examples.html +++ /dev/null @@ -1,32 +0,0 @@ -{% assign xmp_repl = false %} -{% assign xmp_auth = false %} - -{% for page in site.pages %} - {% case page.xmp_id %} - {% when 'WORKING_WITH_THE_OPA_REPL' %} - {% assign xmp_repl = page %} - {% when 'DOCKER_AUTHORIZATION' %} - {% assign xmp_auth = page %} - {% when 'HTTP_API_AUTHORIZATION' %} - {% assign xmp_http_api_auth = page %} - {% when 'SSH_SUDO_AUTHORIZATION' %} - {% assign xmp_ssh_sudo_auth = page %} - {% endcase %} -{% endfor %} - - diff --git a/site/_includes/nav-main.html b/site/_includes/nav-main.html index 0b242ef31b..e5901720b4 100644 --- a/site/_includes/nav-main.html +++ b/site/_includes/nav-main.html @@ -1,7 +1,7 @@ {% assign page_top = false %} {% assign page_get = false %} {% assign page_doc = false %} -{% assign page_xmp = false %} +{% assign page_tutorial = false %} {% assign page_com = false %} {% for page in site.pages %} @@ -14,9 +14,9 @@ {% if page.doc_id == 'WHAT_IS_POLICY_ENABLEMENT' %} {% assign page_doc = page %} {% endif %} - {% when 'MAIN_EXAMPLES' %} - {% if page.xmp_id == 'WORKING_WITH_THE_OPA_REPL' %} - {% assign page_xmp = page %} + {% when 'MAIN_TUTORIALS' %} + {% if page.tutorial_id == 'WORKING_WITH_THE_OPA_REPL' %} + {% assign page_tutorial = page %} {% endif %} {% when 'MAIN_COMMUNITY' %} {% assign page_com = page %} @@ -34,8 +34,8 @@
  • {% if page.nav_id != page_doc.nav_id %}Documentation{% else %}Documentation{% endif %}
  • -
  • - {% if page.nav_id != page_xmp.nav_id %}Examples{% else %}Examples{% endif %} +
  • + {% if page.nav_id != page_tutorial.nav_id %}Tutorials{% else %}Tutorials{% endif %}
  • {% if page.nav_id != page_com.nav_id %}Community{% else %}Community{% endif %} diff --git a/site/_includes/nav-tutorials.html b/site/_includes/nav-tutorials.html new file mode 100644 index 0000000000..5e5e3b276e --- /dev/null +++ b/site/_includes/nav-tutorials.html @@ -0,0 +1,34 @@ +{% assign tutorial_repl = false %} +{% assign tutorial_auth = false %} +{% assign tutorial_http_api_auth = false %} +{% assign tutorial_ssh_sudo_auth = false %} + +{% for page in site.pages %} + {% case page.tutorial_id %} + {% when 'WORKING_WITH_THE_OPA_REPL' %} + {% assign tutorial_repl = page %} + {% when 'DOCKER_AUTHORIZATION' %} + {% assign tutorial_auth = page %} + {% when 'HTTP_API_AUTHORIZATION' %} + {% assign tutorial_http_api_auth = page %} + {% when 'SSH_SUDO_AUTHORIZATION' %} + {% assign tutorial_ssh_sudo_auth = page %} + {% endcase %} +{% endfor %} + + diff --git a/site/_layouts/examples.html b/site/_layouts/tutorials.html similarity index 93% rename from site/_layouts/examples.html rename to site/_layouts/tutorials.html index 684e458d6e..6424360eae 100644 --- a/site/_layouts/examples.html +++ b/site/_layouts/tutorials.html @@ -9,7 +9,7 @@
    - {% include nav-examples.html %} + {% include nav-tutorials.html %} {% contentblock header %}
    diff --git a/site/examples/docker-authorization/index.md b/site/tutorials/docker-authorization/index.md similarity index 93% rename from site/examples/docker-authorization/index.md rename to site/tutorials/docker-authorization/index.md index bddd56d4d0..45d45a376d 100644 --- a/site/examples/docker-authorization/index.md +++ b/site/tutorials/docker-authorization/index.md @@ -1,8 +1,8 @@ --- sort_order: 1001 -nav_id: MAIN_EXAMPLES -xmp_id: DOCKER_AUTHORIZATION -layout: examples +nav_id: MAIN_TUTORIALS +tutorial_id: DOCKER_AUTHORIZATION +layout: tutorials title: Docker Authorization --- @@ -20,7 +20,7 @@ This is an excellent opportunity to see how to policy enable an existing service ## Goals -This example helps you get started with OPA and introduces you to core concepts in OPA, including Rego the language used to define policies. +This tutorial helps you get started with OPA and introduces you to core concepts in OPA, including Rego the language used to define policies. > Policy enabling an application decouples the policy implementation from the business logic so that administrators can define policy without changing the application while still keeping up with the size, complexity, and dynamic nature of modern applications. {: .opa-tip} @@ -30,12 +30,12 @@ Although there are a multitude of desirable access control policies, for demonst * Containers with insecure configurations. * Users modifying the system without sufficient read+write access. -This example illustrates two key concepts: +This tutorial illustrates two key concepts: 1. OPA policy definition is decoupled from the implementation of the service (in this case Docker). The administrator is empowered to define and manage policies without requiring changes to any of the apps. 2. Both the data relevant to policy and the policy definitions themselves can change rapidly. -Once you finish this example, you will be familiar with: +Once you finish this tutorial, you will be familiar with: * Running OPA as a server/daemon. * Loading policy definitions and data via the REST APIs. @@ -44,12 +44,12 @@ Once you finish this example, you will be familiar with: ## Prerequisites -This example requires: +This tutorial requires: * Docker Engine 1.11 or newer * `root` or `sudo` access -The example has been tested on the following platforms: +The tutorial has been tested on the following platforms: * Ubuntu 16.04 (64-bit) @@ -77,7 +77,7 @@ $ chmod u+x opa $ ./opa run --server --log-level debug ``` -OPA will run until it receives a signal to stop. Open another terminal to continue with the rest of the example. +OPA will run until it receives a signal to stop. Open another terminal to continue with the rest of the tutorial. ### 4. Download the [open-policy-agent/opa-docker-authz](https://github.com/open-policy-agent/opa-docker-authz) executable. @@ -233,11 +233,11 @@ Congratulations! You have successfully prevented containers from running without So far, the policy has been defined in terms of input data from the plugin. In many cases, it's necessary to write policies against multiple data sources. -The rest of the example shows how you can grant fine grained access to specific clients. To do so, we will insert fake user data into OPA to simulate an authentication system. +The rest of the tutorial shows how you can grant fine grained access to specific clients. To do so, we will insert fake user data into OPA to simulate an authentication system. ### 12. Identify the user in Docker requests. -> Back up your existing Docker configuration, just in case. You can replace your original configuration after you are done with the example. +> Back up your existing Docker configuration, just in case. You can replace your original configuration after you are done with the tutorial. {: .opa-tip} ```shell @@ -257,7 +257,7 @@ $ cat >~/.docker/config.json <