1 |
/** |
2 |
* privs.h: Fine grained services operator privileges |
3 |
* |
4 |
* Copyright © 2007 Pippijn van Steenhoven / The Ermyth Team |
5 |
* Rights to this code are as documented in COPYING. |
6 |
* |
7 |
* |
8 |
* Portions of this file were derived from sources bearing the following license: |
9 |
* Copyright © 2005 Jilles Tjoelker, et al. |
10 |
* Rights to this code are as documented in doc/pod/license.pod. |
11 |
* |
12 |
* $Id: privs.h,v 1.3 2007-08-28 17:08:07 pippijn Exp $ |
13 |
*/ |
14 |
|
15 |
#ifndef PRIVS_H |
16 |
#define PRIVS_H |
17 |
|
18 |
#define PRIV_NONE NULL |
19 |
|
20 |
/* nickserv/userserv */ |
21 |
#define PRIV_USER_AUSPEX "user:auspex" |
22 |
#define PRIV_USER_ADMIN "user:admin" |
23 |
#define PRIV_USER_SENDPASS "user:sendpass" |
24 |
#define PRIV_USER_VHOST "user:vhost" |
25 |
#define PRIV_USER_FREGISTER "user:fregister" |
26 |
/* chanserv */ |
27 |
#define PRIV_CHAN_AUSPEX "chan:auspex" |
28 |
#define PRIV_CHAN_ADMIN "chan:admin" |
29 |
#define PRIV_CHAN_CMODES "chan:cmodes" |
30 |
#define PRIV_JOIN_STAFFONLY "chan:joinstaffonly" |
31 |
/* nickserv/userserv+chanserv */ |
32 |
#define PRIV_MARK "user:mark" |
33 |
#define PRIV_HOLD "user:hold" |
34 |
#define PRIV_REG_NOLIMIT "user:regnolimit" |
35 |
/* generic */ |
36 |
#define PRIV_SERVER_AUSPEX "general:auspex" |
37 |
#define PRIV_VIEWPRIVS "general:viewprivs" |
38 |
#define PRIV_FLOOD "general:flood" |
39 |
#define PRIV_METADATA "general:metadata" |
40 |
#define PRIV_ADMIN "general:admin" |
41 |
/* operserv */ |
42 |
#define PRIV_OMODE "operserv:omode" |
43 |
#define PRIV_AKILL "operserv:akill" |
44 |
#define PRIV_MASS_AKILL "operserv:massakill" |
45 |
#define PRIV_AKILL_ANYMASK "operserv:akill-anymask" |
46 |
#define PRIV_JUPE "operserv:jupe" |
47 |
#define PRIV_NOOP "operserv:noop" |
48 |
#define PRIV_GLOBAL "operserv:global" |
49 |
#define PRIV_GRANT "operserv:grant" |
50 |
|
51 |
/* obsolete access levels */ |
52 |
#define AC_NONE NULL |
53 |
/* please do not use the following anymore */ |
54 |
#define AC_IRCOP "special:ircop" |
55 |
#define AC_SRA "general:admin" |
56 |
|
57 |
struct operclass_t : zero_initialised |
58 |
{ |
59 |
char *name; |
60 |
char *privs; /* priv1 priv2 priv3... */ |
61 |
int flags; |
62 |
}; |
63 |
|
64 |
#define OPERCLASS_NEEDOPER 0x1 /* only give privs to IRCops */ |
65 |
|
66 |
/* soper list struct */ |
67 |
struct soper_t : zero_initialised |
68 |
{ |
69 |
myuser_t *myuser; |
70 |
char *name; |
71 |
operclass_t *operclass; |
72 |
char *classname; |
73 |
int flags; |
74 |
}; |
75 |
|
76 |
#define SOPER_CONF 0x1 /* oper is listed in atheme.conf */ |
77 |
|
78 |
/* privs.c */ |
79 |
E list_t operclasslist; |
80 |
E list_t soperlist; |
81 |
|
82 |
E void init_privs (void); |
83 |
|
84 |
E operclass_t *operclass_add (char *name, char const *privs); |
85 |
E void operclass_delete (operclass_t *operclass); |
86 |
E operclass_t *operclass_find (char const * const name); |
87 |
|
88 |
E soper_t *soper_add (char *name, char *classname, int flags); |
89 |
E void soper_delete (soper_t *soper); |
90 |
E soper_t *soper_find (myuser_t *myuser); |
91 |
E soper_t *soper_find_named (char *name); |
92 |
|
93 |
E bool is_soper (myuser_t *myuser); |
94 |
E bool is_conf_soper (myuser_t *myuser); |
95 |
|
96 |
/* has_any_privs(): used to determine whether we should give detailed |
97 |
* messages about disallowed things |
98 |
* warning: do not use this for any kind of real privilege! */ |
99 |
E bool has_any_privs (sourceinfo_t *si); |
100 |
E bool has_any_privs_user (user_t *u); |
101 |
/* has_priv(): for sources of commands */ |
102 |
E bool has_priv (sourceinfo_t *si, char const * const priv); |
103 |
/* has_priv_user(): for online users */ |
104 |
E bool has_priv_user (user_t *u, char const * const priv); |
105 |
/* has_priv_myuser(): channel succession etc */ |
106 |
E bool has_priv_myuser (myuser_t *mu, char const * const priv); |
107 |
/* has_priv_operclass(): /os specs etc */ |
108 |
E bool has_priv_operclass (operclass_t *oc, char const * const priv); |
109 |
/* has_all_operclass(): checks if source has all privs in operclass */ |
110 |
E bool has_all_operclass (sourceinfo_t *si, operclass_t *oc); |
111 |
|
112 |
#endif /* PRIVS_H */ |