session: expose rpc_session_access() function for testing session ACLs in other rpcd subsystems

This commit is contained in:
Jo-Philipp Wich 2013-08-12 13:51:51 +02:00
parent 743901cfca
commit c6985dd5a6
2 changed files with 14 additions and 0 deletions

View file

@ -709,3 +709,14 @@ int rpc_session_api_init(struct ubus_context *ctx)
return ubus_add_object(ctx, &obj); 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);
}

View file

@ -56,4 +56,7 @@ struct rpc_session_acl {
int rpc_session_api_init(struct ubus_context *ctx); 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 #endif