ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/ermyth/include/privs.h
Revision: 1.5
Committed: Sat Sep 22 14:27:26 2007 UTC (16 years, 7 months ago) by pippijn
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.4: +15 -5 lines
Log Message:
split up ermyth into ermyth-modules, libermyth (currently just ermyth-util) and ermyth-core

File Contents

# Content
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.4 2007-09-16 18:54:42 pippijn Exp $
13 */
14
15 #ifndef PRIVS_H
16 #define PRIVS_H
17
18 #include <util/containers.h>
19
20 #define PRIV_NONE NULL
21
22 /* nickserv/userserv */
23 #define PRIV_USER_AUSPEX "user:auspex"
24 #define PRIV_USER_ADMIN "user:admin"
25 #define PRIV_USER_SENDPASS "user:sendpass"
26 #define PRIV_USER_VHOST "user:vhost"
27 #define PRIV_USER_FREGISTER "user:fregister"
28 /* chanserv */
29 #define PRIV_CHAN_AUSPEX "chan:auspex"
30 #define PRIV_CHAN_ADMIN "chan:admin"
31 #define PRIV_CHAN_CMODES "chan:cmodes"
32 #define PRIV_JOIN_STAFFONLY "chan:joinstaffonly"
33 /* nickserv/userserv+chanserv */
34 #define PRIV_MARK "user:mark"
35 #define PRIV_HOLD "user:hold"
36 #define PRIV_REG_NOLIMIT "user:regnolimit"
37 /* generic */
38 #define PRIV_SERVER_AUSPEX "general:auspex"
39 #define PRIV_VIEWPRIVS "general:viewprivs"
40 #define PRIV_FLOOD "general:flood"
41 #define PRIV_METADATA "general:metadata"
42 #define PRIV_ADMIN "general:admin"
43 /* operserv */
44 #define PRIV_OMODE "operserv:omode"
45 #define PRIV_AKILL "operserv:akill"
46 #define PRIV_MASS_AKILL "operserv:massakill"
47 #define PRIV_AKILL_ANYMASK "operserv:akill-anymask"
48 #define PRIV_JUPE "operserv:jupe"
49 #define PRIV_NOOP "operserv:noop"
50 #define PRIV_GLOBAL "operserv:global"
51 #define PRIV_GRANT "operserv:grant"
52
53 /* obsolete access levels */
54 #define AC_NONE NULL
55 /* please do not use the following anymore */
56 #define AC_IRCOP "special:ircop"
57 #define AC_SRA "general:admin"
58
59 struct operclass_t : zero_initialised
60 {
61 unsigned index;
62 typedef indexing_vector<operclass_t> list_type;
63 /* privs.c */
64 static list_type list;
65
66 char *name;
67 char *privs; /* priv1 priv2 priv3... */
68 int flags;
69 };
70
71 #define OPERCLASS_NEEDOPER 0x1 /* only give privs to IRCops */
72
73 /* soper list struct */
74 struct soper_t : zero_initialised
75 {
76 unsigned index;
77 typedef indexing_vector<soper_t> list_type;
78 /* privs.c */
79 static list_type list;
80
81 myuser_t *myuser;
82 char *name;
83 operclass_t *operclass;
84 char *classname;
85 int flags;
86 };
87
88 #define SOPER_CONF 0x1 /* oper is listed in atheme.conf */
89
90 E void init_privs (void);
91
92 E operclass_t *operclass_add (char *name, char const *privs);
93 E void operclass_delete (operclass_t *operclass);
94 E operclass_t *operclass_find (char const * const name);
95 E void operclass_cleanup ();
96
97 E soper_t *soper_add (char *name, char *classname, int flags);
98 E void soper_delete (soper_t *soper);
99 E soper_t *soper_find (myuser_t *myuser);
100 E soper_t *soper_find_named (char *name);
101 E void soper_cleanup ();
102
103 E bool is_soper (myuser_t *myuser);
104 E bool is_conf_soper (myuser_t *myuser);
105
106 /* has_any_privs(): used to determine whether we should give detailed
107 * messages about disallowed things
108 * warning: do not use this for any kind of real privilege! */
109 E bool has_any_privs (sourceinfo_t *si);
110 E bool has_any_privs_user (user_t *u);
111 /* has_priv(): for sources of commands */
112 E bool has_priv (sourceinfo_t *si, char const * const priv);
113 /* has_priv_user(): for online users */
114 E bool has_priv_user (user_t *u, char const * const priv);
115 /* has_priv_myuser(): channel succession etc */
116 E bool has_priv_myuser (myuser_t *mu, char const * const priv);
117 /* has_priv_operclass(): /os specs etc */
118 E bool has_priv_operclass (operclass_t *oc, char const * const priv);
119 /* has_all_operclass(): checks if source has all privs in operclass */
120 E bool has_all_operclass (sourceinfo_t *si, operclass_t *oc);
121
122 #endif /* PRIVS_H */