2 * This file is part of DisOrder
3 * Copyright (C) 2007 Richard Kettlewell
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 /** @file lib/rights.h
29 /** @brief User can perform read-only operations */
30 #define RIGHT_READ 0x00000001
32 /** @brief User can add tracks to the queue */
33 #define RIGHT_PLAY 0x00000002
35 /** @brief User can move any track */
36 #define RIGHT_MOVE_ANY 0x00000004
38 /** @brief User can move their own tracks */
39 #define RIGHT_MOVE_MINE 0x00000008
41 /** @brief User can move randomly chosen tracks */
42 #define RIGHT_MOVE_RANDOM 0x00000010
44 #define RIGHT_MOVE__MASK 0x0000001c
46 /** @brief User can remove any track */
47 #define RIGHT_REMOVE_ANY 0x00000020
49 /** @brief User can remove their own tracks */
50 #define RIGHT_REMOVE_MINE 0x00000040
52 /** @brief User can remove randomly chosen tracks */
53 #define RIGHT_REMOVE_RANDOM 0x00000080
55 #define RIGHT_REMOVE__MASK 0x000000e0
57 /** @brief User can scratch any track */
58 #define RIGHT_SCRATCH_ANY 0x00000100
60 /** @brief User can scratch their own tracks */
61 #define RIGHT_SCRATCH_MINE 0x00000200
63 /** @brief User can scratch randomly chosen tracks */
64 #define RIGHT_SCRATCH_RANDOM 0x00000400
66 #define RIGHT_SCRATCH__MASK 0x00000700
68 /** @brief User can change the volume */
69 #define RIGHT_VOLUME 0x00000800
71 /** @brief User can perform admin operations */
72 #define RIGHT_ADMIN 0x00001000
74 /** @brief User can initiate a rescan */
75 #define RIGHT_RESCAN 0x00002000
77 /** @brief User can register new users */
78 #define RIGHT_REGISTER 0x00004000
80 /** @brief User can edit their own userinfo */
81 #define RIGHT_USERINFO 0x00008000
83 /** @brief User can modify track preferences */
84 #define RIGHT_PREFS 0x00010000
86 /** @brief User can modify global preferences */
87 #define RIGHT_GLOBAL_PREFS 0x00020000
89 /** @brief User can pause/resume */
90 #define RIGHT_PAUSE 0x00040000
92 /** @brief Current rights mask */
93 #define RIGHTS__MASK 0x0007ffff
95 /** @brief Connection is local
97 * This isn't a rights bit, it's used in @file server.c to limit
98 * certain commands to local connections.
100 #define RIGHT__LOCAL 0x80000000
102 /** @brief Unsigned type big enough for rights */
103 typedef uint32_t rights_type;
105 char *rights_string(rights_type r);
106 int parse_rights(const char *s, rights_type *rp, int report);
107 int right_scratchable(rights_type rights, const char *who,
108 const struct queue_entry *q);
109 int right_movable(rights_type rights, const char *who,
110 const struct queue_entry *q);
111 int right_removable(rights_type rights, const char *who,
112 const struct queue_entry *q);
114 #endif /* RIGHTS_H */