ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/ermyth/include/privs.h
Revision: 1.2
Committed: Sat Jul 21 01:29:07 2007 UTC (16 years, 10 months ago) by pippijn
Content type: text/plain
Branch: MAIN
Changes since 1.1: +2 -2 lines
Log Message:
- moved to new documentation system
- fixed small build error

File Contents

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