0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-27 07:54:05 +01:00

ircd:Ⓜ️:vm: Add #DENIED fault code.

This commit is contained in:
Jason Volk 2023-02-18 17:10:01 -08:00
parent de1a566909
commit 262bde6fdf
3 changed files with 5 additions and 1 deletions

View file

@ -40,4 +40,5 @@ enum ircd::m::vm::fault
EVENT = 0x0020, ///< Eval requires addl events in the ef register. (#ef) EVENT = 0x0020, ///< Eval requires addl events in the ef register. (#ef)
BOUNCE = 0x0040, ///< The event is not needed at this time. (#bo) BOUNCE = 0x0040, ///< The event is not needed at this time. (#bo)
DONOTWANT = 0x0080, ///< The event will never be needed (cache this). (#dw) DONOTWANT = 0x0080, ///< The event will never be needed (cache this). (#dw)
DENIED = 0x0100, ///< Access of evaluator insufficient. (#ad)
}; };

View file

@ -159,6 +159,7 @@ ircd::m::vm::http_code(const fault &code)
case fault::EVENT: return http::NOT_FOUND; case fault::EVENT: return http::NOT_FOUND;
case fault::BOUNCE: break; case fault::BOUNCE: break;
case fault::DONOTWANT: break; case fault::DONOTWANT: break;
case fault::DENIED: return http::FORBIDDEN;
} }
return http::INTERNAL_SERVER_ERROR; return http::INTERNAL_SERVER_ERROR;
@ -178,6 +179,7 @@ ircd::m::vm::reflect(const enum fault &code)
case fault::STATE: return "#STATE"; case fault::STATE: return "#STATE";
case fault::BOUNCE: return "#BOUNCE"; case fault::BOUNCE: return "#BOUNCE";
case fault::DONOTWANT: return "#DONOTWANT"; case fault::DONOTWANT: return "#DONOTWANT";
case fault::DENIED: return "#DENIED";
} }
return "??????"; return "??????";

View file

@ -44,8 +44,9 @@ ircd::m::on_check_room_server_acl(const event &event,
return; return;
if(!m::room::server_acl::check(at<"room_id"_>(event), at<"origin"_>(event))) if(!m::room::server_acl::check(at<"room_id"_>(event), at<"origin"_>(event)))
throw m::ACCESS_DENIED throw vm::error
{ {
vm::fault::DENIED,
"Server '%s' denied by room %s access control list.", "Server '%s' denied by room %s access control list.",
at<"origin"_>(event), at<"origin"_>(event),
at<"room_id"_>(event), at<"room_id"_>(event),