Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
4b72d087
Commit
4b72d087
authored
Jan 11, 2019
by
antirez
Browse files
ACL: ACLSetUser(), initial ideas in comments.
parent
dc4f7ad1
Changes
1
Show whitespace changes
Inline
Side-by-side
src/acl.c
View file @
4b72d087
...
@@ -109,10 +109,41 @@ user *ACLCreateUser(const char *name, size_t namelen) {
...
@@ -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,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment