]> jfr.im git - irc/quakenet/snircd.git/blame - doc/api/privileges.txt
sync undernet upstream ircu changes.
[irc/quakenet/snircd.git] / doc / api / privileges.txt
CommitLineData
189935b1 1Access control becomes more of a problem as you have more and more
2users that need to access certain features. As it stands, ircu has
3only 3 access levels: ordinary user, local operator, and global
4operator. This is hardly enough control, especially over some of the
5more advanced and powerful features, such as G-lines.
6
7Since u2.10.11, ircu includes the concept of privileges. Privileges
8are basically an arbitrarily long bit string. Access to particular
9features is governed by the value of a particular bit of that bit
10string--in other words, privileges are a form of Access Control List.
11This document covers the basic structures and macros used by the
12privileges system.
13
14<struct>
15struct Privs;
16
17The Privs structure stores a privileges bit string and represents a
18user's entire privilege set. This is implemented as a structure,
19rather than as an array of integers, in order to leverage C's
20structure copy.
21</struct>
22
23<function>
24void PrivSet(struct Privs pset, int priv);
25
26This macro sets the privilege specified by _priv_ in the privileges
27structure. This macro evaluates the _priv_ argument twice.
28</function>
29
30<function>
31void PrivClr(struct Privs pset, int priv);
32
33This macro clears the privilege specified by _priv_ in the privileges
34structure. This macro evaluates the _priv_ argument twice.
35</function>
36
37<function>
38int PrivHas(struct Privs pset, int priv);
39
40This macro tests whether the privilege specified by _priv_ is set in
41the privileges structure, returning non-zero if it is. This macro
42evaluates the _priv_ argument twice.
43</function>
44
45<function>
46void GrantPriv(struct Client* cli, int priv);
47
48This macro grants a particular client, specified by _cli_, the
49privilege specified by _priv_. This macro evaluates the _priv_
50argument twice.
51</function>
52
53<function>
54void RevokePriv(struct Client* cli, int priv);
55
56This macro revokes the privilege specified by _priv_ from the client.
57This macro evaluates the _priv_ argument twice.
58</function>
59
60<function>
61int HasPriv(struct Client* cli, int priv);
62
63This macro tests whether the client specified by _cli_ has the
64privilege specified by _priv_, returning non-zero if so. This macro
65evaluates the _priv_ argument twice.
66</function>
67
68<function>
69void client_set_privs(struct Client* client);
70
71The ircu configuration file does not yet support privileges. This
72function thus sets the appropriate privileges for an operator, based
73upon various feature settings. It should be called whenever there is
74a change in a user's IRC operator status.
75</function>
76
77<function>
78int client_report_privs(struct Client *to, struct Client *client);
79
80This function sends the client specified by _to_ a list of the
81privileges that another client has. It returns a value of 0 for the
82convenience of other functions that must return an integer value.
83</function>
84
85<authors>
86Kev <klmitch@mit.edu>
87</authors>
88
89<changelog>
90[2001-6-15 Kev] Initial documentation of the privileges system.
91</changelog>