1 | /* |
1 | /* |
2 | * Copyright © 2005 Jilles Tjoelker, et al. |
2 | * Copyright © 2005 Jilles Tjoelker, et al. |
3 | * Rights to this code are as documented in doc/pod/license.pod. |
3 | * Rights to this code are as documented in doc/pod/license.pod. |
4 | * |
4 | * |
5 | * Fine grained services operator privileges |
5 | * Fine grained services operator privileges |
6 | * |
6 | * |
7 | * $Id: privs.h,v 1.2 2007/07/21 01:29:07 pippijn Exp $ |
7 | * $Id: privs.h,v 1.3 2007/08/28 17:08:07 pippijn Exp $ |
8 | */ |
8 | */ |
9 | |
9 | |
10 | #ifndef PRIVS_H |
10 | #ifndef PRIVS_H |
11 | #define PRIVS_H |
11 | #define PRIVS_H |
12 | |
12 | |
… | |
… | |
35 | #define PRIV_ADMIN "general:admin" |
35 | #define PRIV_ADMIN "general:admin" |
36 | /* operserv */ |
36 | /* operserv */ |
37 | #define PRIV_OMODE "operserv:omode" |
37 | #define PRIV_OMODE "operserv:omode" |
38 | #define PRIV_AKILL "operserv:akill" |
38 | #define PRIV_AKILL "operserv:akill" |
39 | #define PRIV_MASS_AKILL "operserv:massakill" |
39 | #define PRIV_MASS_AKILL "operserv:massakill" |
|
|
40 | #define PRIV_AKILL_ANYMASK "operserv:akill-anymask" |
40 | #define PRIV_JUPE "operserv:jupe" |
41 | #define PRIV_JUPE "operserv:jupe" |
41 | #define PRIV_NOOP "operserv:noop" |
42 | #define PRIV_NOOP "operserv:noop" |
42 | #define PRIV_GLOBAL "operserv:global" |
43 | #define PRIV_GLOBAL "operserv:global" |
43 | #define PRIV_GRANT "operserv:grant" |
44 | #define PRIV_GRANT "operserv:grant" |
44 | |
45 | |
… | |
… | |
46 | #define AC_NONE NULL |
47 | #define AC_NONE NULL |
47 | /* please do not use the following anymore */ |
48 | /* please do not use the following anymore */ |
48 | #define AC_IRCOP "special:ircop" |
49 | #define AC_IRCOP "special:ircop" |
49 | #define AC_SRA "general:admin" |
50 | #define AC_SRA "general:admin" |
50 | |
51 | |
51 | struct operclass_t |
52 | struct operclass_t : zero_initialised |
52 | { |
53 | { |
53 | char *name; |
54 | char *name; |
54 | char *privs; /* priv1 priv2 priv3... */ |
55 | char *privs; /* priv1 priv2 priv3... */ |
55 | int flags; |
56 | int flags; |
56 | }; |
57 | }; |
57 | |
58 | |
58 | #define OPERCLASS_NEEDOPER 0x1 /* only give privs to IRCops */ |
59 | #define OPERCLASS_NEEDOPER 0x1 /* only give privs to IRCops */ |
59 | |
60 | |
60 | /* soper list struct */ |
61 | /* soper list struct */ |
61 | struct soper_t |
62 | struct soper_t : zero_initialised |
62 | { |
63 | { |
63 | myuser_t *myuser; |
64 | myuser_t *myuser; |
64 | char *name; |
65 | char *name; |
65 | operclass_t *operclass; |
66 | operclass_t *operclass; |
66 | char *classname; |
67 | char *classname; |
… | |
… | |
75 | |
76 | |
76 | E void init_privs (void); |
77 | E void init_privs (void); |
77 | |
78 | |
78 | E operclass_t *operclass_add (char *name, char const *privs); |
79 | E operclass_t *operclass_add (char *name, char const *privs); |
79 | E void operclass_delete (operclass_t *operclass); |
80 | E void operclass_delete (operclass_t *operclass); |
80 | E operclass_t *operclass_find (char *name); |
81 | E operclass_t *operclass_find (char const * const name); |
81 | |
82 | |
82 | E soper_t *soper_add (char *name, char *classname, int flags); |
83 | E soper_t *soper_add (char *name, char *classname, int flags); |
83 | E void soper_delete (soper_t *soper); |
84 | E void soper_delete (soper_t *soper); |
84 | E soper_t *soper_find (myuser_t *myuser); |
85 | E soper_t *soper_find (myuser_t *myuser); |
85 | E soper_t *soper_find_named (char *name); |
86 | E soper_t *soper_find_named (char *name); |
… | |
… | |
88 | E bool is_conf_soper (myuser_t *myuser); |
89 | E bool is_conf_soper (myuser_t *myuser); |
89 | |
90 | |
90 | /* has_any_privs(): used to determine whether we should give detailed |
91 | /* has_any_privs(): used to determine whether we should give detailed |
91 | * messages about disallowed things |
92 | * messages about disallowed things |
92 | * warning: do not use this for any kind of real privilege! */ |
93 | * warning: do not use this for any kind of real privilege! */ |
93 | E bool has_any_privs (sourceinfo_t *); |
94 | E bool has_any_privs (sourceinfo_t *si); |
94 | E bool has_any_privs_user (user_t *); |
95 | E bool has_any_privs_user (user_t *u); |
95 | /* has_priv(): for sources of commands */ |
96 | /* has_priv(): for sources of commands */ |
96 | E bool has_priv (sourceinfo_t *, const char *); |
97 | E bool has_priv (sourceinfo_t *si, char const * const priv); |
97 | /* has_priv_user(): for online users */ |
98 | /* has_priv_user(): for online users */ |
98 | E bool has_priv_user (user_t *, const char *); |
99 | E bool has_priv_user (user_t *u, char const * const priv); |
99 | /* has_priv_myuser(): channel succession etc */ |
100 | /* has_priv_myuser(): channel succession etc */ |
100 | E bool has_priv_myuser (myuser_t *, const char *); |
101 | E bool has_priv_myuser (myuser_t *mu, char const * const priv); |
101 | /* has_priv_operclass(): /os specs etc */ |
102 | /* has_priv_operclass(): /os specs etc */ |
102 | E bool has_priv_operclass (operclass_t *, const char *); |
103 | E bool has_priv_operclass (operclass_t *oc, char const * const priv); |
103 | /* has_all_operclass(): checks if source has all privs in operclass */ |
104 | /* has_all_operclass(): checks if source has all privs in operclass */ |
104 | E bool has_all_operclass (sourceinfo_t *, operclass_t *); |
105 | E bool has_all_operclass (sourceinfo_t *si, operclass_t *oc); |
105 | |
106 | |
106 | #endif /* PRIVS_H */ |
107 | #endif /* PRIVS_H */ |