summaryrefslogtreecommitdiff
path: root/skel/gitano-admin/rules/defines.lace
blob: ec3fbd15393ec0066748c574d31178ebbf49c3c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# This file is part of the standard ruleset from Gitano
# Copyright 2012-2017 Daniel Silverstone <dsilvers@digital-scurf.org>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
# 3. Neither the name of the author nor the names of their contributors
#    may be used to endorse or promote products derived from this software
#    without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# A useful set of defines

# User/group related
define is_admin group exact gitano-admin
define is_owner config/project/owner exact ${user}

define repo_is_personal repository prefix personal/${user}/

define if_asanother as_user pattern .

# Self-related operations
define op_whoami operation exact whoami
define op_sshkey operation exact sshkey
define op_passwd operation exact passwd
define op_self anyof op_whoami op_sshkey op_passwd

# Admin-related operations

## Users
define op_useradd operation exact useradd
define op_userdel operation exact userdel
define op_userlist operation exact userlist
define op_useremail operation exact useremail
define op_username operation exact username
define op_userrename operation exact userrename
define op_user anyof op_userlist op_useradd op_userdel op_useremail op_username op_userrename

## Groups
define op_grouplist operation exact grouplist
define op_groupshow operation exact groupshow
define op_groupadd operation exact groupadd
define op_groupdel operation exact groupdel
define op_grouprename operation exact grouprename
define op_groupadduser operation exact groupadduser
define op_groupdeluser operation exact groupdeluser
define op_groupaddgroup operation exact groupaddgroup
define op_groupdelgroup operation exact groupdelgroup
define op_groupdescription operation exact groupdescription
define op_group anyof op_grouplist op_groupshow op_groupadd op_groupdel op_groupadduser op_groupdeluser op_groupaddgroup op_groupdelgroup op_groupdescription op_grouprename

## Graveyard
define op_graveyardlist operation exact graveyardlist
define op_graveyardrestore operation exact graveyardrestore
define op_graveyardpurge operation exact graveyardpurge
define op_graveyard anyof op_graveyardlist op_graveyardrestore op_graveyardpurge

## Keyring
define op_keyringlist operation exact keyringlist
define op_keyringshow operation exact keyringshow
define op_keyringcreate operation exact keyringcreate
define op_keyringdestroy operation exact keyringdestroy
define op_keyringaddkey operation exact keyringaddkey
define op_keyringdelkey operation exact keyringdelkey
define op_keyring anyof op_keyringlist op_keyringshow op_keyringcreate op_keyringdestroy op_keyringaddkey op_keyringdelkey

## Aggregation of admin ops
define op_is_admin anyof op_user op_group op_graveyard op_keyring

# Primary repository-related operations
define op_read operation exact read
define op_write operation exact write
define op_createrepo operation exact createrepo
define op_renamerepo operation exact renamerepo
define op_destroyrepo operation exact destroyrepo

# Remote configuration operations
define op_config_show operation exact config_show
define op_config_set operation exact config_set
define op_config_del operation exact config_del
define op_is_config anyof op_config_show op_config_set op_config_del

# Reference update related operations
define op_createref operation exact createref
define op_deleteref operation exact deleteref
define op_fastforward operation exact updaterefff
define op_forcedupdate operation exact updaterefnonff

# Combinator operations
define op_is_basic anyof op_read op_write
define op_is_update anyof op_fastforward op_forcedupdate
define op_is_normal anyof op_fastforward op_createref op_deleteref

# Administration
define is_admin_repo repository exact gitano-admin
define is_gitano_ref ref prefix refs/gitano/
define is_admin_ref ref exact refs/gitano/admin

# Project readers and writers
define is_project_reader config/project/readers exact ${user}
define is_project_writer config/project/writers exact ${user}