summaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2012-06-29 22:46:13 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2012-06-29 22:46:13 +0100
commit99c62348195590c04c3dc1c9a5dc36ff677b4a31 (patch)
treeaf8605a328a5ad2c0e11faf39a81d0375f9db523 /example
parent46890c9b82ebd5b5f4d1fcceeecd36c51d6880fa (diff)
downloadgitano-99c62348195590c04c3dc1c9a5dc36ff677b4a31.tar.gz
EXAMPLE: Self operations support in the lace
Diffstat (limited to 'example')
-rw-r--r--example/gitano-admin/rules/core.lace3
-rw-r--r--example/gitano-admin/rules/defines.lace4
-rw-r--r--example/gitano-admin/rules/selfchecks.lace5
3 files changed, 12 insertions, 0 deletions
diff --git a/example/gitano-admin/rules/core.lace b/example/gitano-admin/rules/core.lace
index abb3e6c..6d3857b 100644
--- a/example/gitano-admin/rules/core.lace
+++ b/example/gitano-admin/rules/core.lace
@@ -10,6 +10,9 @@ allow "Administrators can do anything" is_admin
# Now let's decide if we can use 'as'
include global:aschecks if_asanother
+# Operations which are against 'self' get checked next
+include global:selfchecks
+
# Owners of repositories are allowed to hand it over
allow "Owners can hand over repositories" is_owner op_setowner
diff --git a/example/gitano-admin/rules/defines.lace b/example/gitano-admin/rules/defines.lace
index 612d467..9c8324f 100644
--- a/example/gitano-admin/rules/defines.lace
+++ b/example/gitano-admin/rules/defines.lace
@@ -6,6 +6,10 @@ define is_owner owner ${user}
define if_asanother as_user ~.
+# Self-related operations
+define op_whoami operation whoami
+define op_sshkey operation sshkey
+
# Primary repository-related operations
define op_read operation read
define op_write operation write
diff --git a/example/gitano-admin/rules/selfchecks.lace b/example/gitano-admin/rules/selfchecks.lace
new file mode 100644
index 0000000..300bb91
--- /dev/null
+++ b/example/gitano-admin/rules/selfchecks.lace
@@ -0,0 +1,5 @@
+# Checks against self
+
+allow "You may ask who you are" op_whoami
+
+allow "You may manage your own ssh keys" op_sshkey