MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / ACLGetUserCommandBit

Function ACLGetUserCommandBit

src/acl.cpp:388–392  ·  view source on GitHub ↗

Check if the specified command bit is set for the specified user. * The function returns 1 is the bit is set or 0 if it is not. * Note that this function does not check the ALLCOMMANDS flag of the user * but just the lowlevel bitmask. * * If the bit overflows the user internal representation, zero is returned * in order to disallow the execution of the command in such edge case. */

Source from the content-addressed store, hash-verified

386 * If the bit overflows the user internal representation, zero is returned
387 * in order to disallow the execution of the command in such edge case. */
388int ACLGetUserCommandBit(user *u, unsigned long id) {
389 uint64_t word, bit;
390 if (ACLGetCommandBitCoordinates(id,&word,&bit) == C_ERR) return 0;
391 return (u->allowed_commands[word] & bit) != 0;
392}
393
394/* When +@all or allcommands is given, we set a reserved bit as well that we
395 * can later test, to see if the user has the right to execute "future commands",

Callers 5

ACLSetUserFunction · 0.85
ACLCheckCommandPermFunction · 0.85

Calls 1

Tested by

no test coverage detected