mirror of
https://github.com/fluencelabs/redis
synced 2025-03-19 17:10:50 +00:00
ACL: ACLSetUser(), initial ideas in comments.
This commit is contained in:
parent
dc4f7ad106
commit
4b72d087e9
31
src/acl.c
31
src/acl.c
@ -109,10 +109,41 @@ user *ACLCreateUser(const char *name, size_t namelen) {
|
|||||||
return u;
|
return u;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Set user properties according to the string "op". The following
|
||||||
|
* is a description of what different strings will do:
|
||||||
|
*
|
||||||
|
* on Enable the user
|
||||||
|
* off Disable the user
|
||||||
|
* +<command> Allow the execution of that command
|
||||||
|
* -<command> Disallow the execution of that command
|
||||||
|
* +@<category> Allow the execution of all the commands in such category
|
||||||
|
* with valid categories being @set, @sortedset, @list, @hash,
|
||||||
|
* @string, @bitmap, @hyperloglog,
|
||||||
|
* @stream, @admin, @readonly,
|
||||||
|
* @readwrite, @fast, @slow,
|
||||||
|
* @pubsub.
|
||||||
|
* The special category @all means all the commands.
|
||||||
|
* +<command>|subcommand Allow a specific subcommand of an otherwise
|
||||||
|
* disabled command. Note that this form is not
|
||||||
|
* allowed as negative like -DEBUG|SEGFAULT, but
|
||||||
|
* only additive starting with "+".
|
||||||
|
* ~<pattern> Set a pattern of keys that can be mentioned as part of
|
||||||
|
* commands. For instance ~* allows all the keys. The pattern
|
||||||
|
* is a glob-style pattern like the one of KEYS.
|
||||||
|
* ><password> Add this passowrd to the list of valid password for the user.
|
||||||
|
* For example >mypass will add "mypass" to the list.
|
||||||
|
* <<password> Remove this password from the list of valid passwords.
|
||||||
|
* resetpass Flush the list of allowed passwords.
|
||||||
|
*/
|
||||||
|
void ACLSetUser(user *u, const char *op) {
|
||||||
|
}
|
||||||
|
|
||||||
/* Initialization of the ACL subsystem. */
|
/* Initialization of the ACL subsystem. */
|
||||||
void ACLInit(void) {
|
void ACLInit(void) {
|
||||||
Users = raxNew();
|
Users = raxNew();
|
||||||
DefaultUser = ACLCreateUser("default",7);
|
DefaultUser = ACLCreateUser("default",7);
|
||||||
|
ACLSetUser(DefaultUser,"+@all");
|
||||||
|
ACLSetUser(DefaultUser,"on");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check the username and password pair and return C_OK if they are valid,
|
/* Check the username and password pair and return C_OK if they are valid,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user