summaryrefslogtreecommitdiffstats
path: root/src/authz.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/authz.h')
-rw-r--r--src/authz.h34
1 files changed, 12 insertions, 22 deletions
diff --git a/src/authz.h b/src/authz.h
index 53f251d..794c12c 100644
--- a/src/authz.h
+++ b/src/authz.h
@@ -49,20 +49,14 @@ typedef struct {
rule_t *rules;
size_t nrules, rcap;
- char *protected_global; /* space separated normalised patterns, or NULL */
- char **prot_repo; /* repositories with their own list */
- char **prot_refs; /* and the list that goes with each */
- size_t nprot, pcap;
-
int errors;
- int warnings;
int unreadable; /* the file itself could not be opened */
char *path; /* what messages call the file */
} policy_t;
typedef struct {
int allowed;
- level_t need; /* what it cost in the end, after any raise */
+ level_t need; /* what it cost in the end */
char why[512]; /* the sentence the person pushing reads */
} decision_t;
@@ -83,8 +77,8 @@ void policy_init(policy_t *p, const char *path);
void policy_free(policy_t *p);
/* Read and parse. Returns 0 when the file is usable, -1 when it produced
- * errors, -2 when it could not be read at all. Errors and warnings are
- * reported as they are found, on stderr, with the line number. */
+ * errors, -2 when it could not be read at all. Errors are reported as they are
+ * found, on stderr, with the line number. */
int policy_load(policy_t *p);
/* Refs and repositories have one spelling each internally. A bare name is a
@@ -115,13 +109,14 @@ int authz_level_of(const char *name);
* "everybody this policy already knows about", and never invents a name. */
int authz_user_known(const policy_t *p, const char *user);
-/* What a ref really costs. Anything that is not a branch or a tag is for
- * maintainers; on a protected ref 'write' is not enough and 'force' is not
- * enough either. When the answer is higher than 'have', the reason
- * ("protected", "neither a branch nor a tag") is written to raised, which must
- * hold at least 64 bytes. */
-level_t authz_need_for(const policy_t *p, const char *repo, const char *ref,
- level_t have, char *raised, size_t raisedsz);
+/* What a ref really costs beyond what the rule said. Anything that is not a
+ * branch or a tag is for maintainers, whatever a rule about it appears to
+ * grant: refs/notes, refs/merge-requests, whatever a tool invents next, are not
+ * part of the namespace a policy was written with in mind, and the safe reading
+ * of "not mentioned" is "not granted". When the answer is higher than 'have',
+ * the reason is written to raised, which must hold at least 64 bytes. */
+level_t authz_need_for(const char *ref, level_t have, char *raised,
+ size_t raisedsz);
/* The decision. 'ref' may be NULL, which asks "may this user do this
* somewhere in the repository" rather than about one ref. */
@@ -133,10 +128,6 @@ void authz_check(const policy_t *p, const char *user, const char *repo,
* matching rather than a decision. */
int authz_repo_reachable(const policy_t *p, const char *repo);
-/* The protected list in force for one repository, as stored (normalised
- * patterns, space separated). Never NULL. */
-const char *authz_protected_for(const policy_t *p, const char *repo);
-
/* --------------------------------------------------------------- hook.c */
/* authorize mode: identity from the environment, ref lines from stdin, the
@@ -179,7 +170,7 @@ typedef struct {
const char *out; /* NULL edits in place; "-" is stdout */
} edit_opts;
-/* Shared by the three editing commands: pulls --out and --stdout out of the
+/* Shared by the two editing commands: pulls --out and --stdout out of the
* argument list wherever they sit (an option at the end reads better in a
* shell history) and compacts what is left into argv, returning the count in
* *consumed. Returns -1 on a missing value. */
@@ -191,7 +182,6 @@ int authz_reject_options(int argc, char **argv);
int cmd_grant(const char *path, edit_opts o, int argc, char **argv);
int cmd_revoke(const char *path, edit_opts o, int argc, char **argv);
-int cmd_protect(const char *path, edit_opts o, int argc, char **argv);
/* ---------------------------------------------------------------- main.c
* Shared little helpers, so that no file invents its own way to fail. */