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
f95152d4
Commit
f95152d4
authored
Jan 14, 2019
by
antirez
Browse files
ACL: Add skeleton for function checking ability to execute a command.
parent
4376575d
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/acl.c
View file @
f95152d4
...
...
@@ -222,6 +222,29 @@ user *ACLGetUserByName(const char *name, size_t namelen) {
return
myuser
;
}
/* Check if the command ready to be excuted in the client 'c', and already
* referenced by c->cmd, can be executed by this client according to the
* ACls associated to the client user c->user.
*
* If the user can execute the command C_OK is returned, otherwise
* C_ERR is returned. */
int
ACLCheckCommandPerm
(
client
*
c
)
{
/* If there is no associated user, the connection can run anything. */
if
(
c
->
user
==
NULL
)
return
C_OK
;
/* Check if the user can execute this command. */
if
(
!
(
c
->
user
->
flags
&
USER_FLAG_ALLCOMMANDS
))
{
}
/* Check if the user can execute touch this keys. */
if
(
!
(
c
->
user
->
flags
&
USER_FLAG_ALLKEYS
))
{
}
/* If we survived all the above checks, the user can execute the
* command. */
return
C_OK
;
}
/* =============================================================================
* ACL related commands
* ==========================================================================*/
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