session: expose rpc_session_access() function for testing session ACLs in other rpcd subsystems
This commit is contained in:
parent
743901cfca
commit
c6985dd5a6
2 changed files with 14 additions and 0 deletions
11
session.c
11
session.c
|
@ -709,3 +709,14 @@ int rpc_session_api_init(struct ubus_context *ctx)
|
|||
|
||||
return ubus_add_object(ctx, &obj);
|
||||
}
|
||||
|
||||
bool rpc_session_access(const char *sid, const char *scope,
|
||||
const char *object, const char *function)
|
||||
{
|
||||
struct rpc_session *ses = rpc_session_get(sid);
|
||||
|
||||
if (!ses)
|
||||
return false;
|
||||
|
||||
return rpc_session_acl_allowed(ses, scope, object, function);
|
||||
}
|
||||
|
|
|
@ -56,4 +56,7 @@ struct rpc_session_acl {
|
|||
|
||||
int rpc_session_api_init(struct ubus_context *ctx);
|
||||
|
||||
bool rpc_session_access(const char *sid, const char *scope,
|
||||
const char *object, const char *function);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue