From fcc7b7cdb4a0d85cb021013f5db8a558f9c13c25 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Fri, 16 Jul 2021 18:39:47 +0100 Subject: Allow toggling a capability from a Cap::Reference. --- include/modules/cap.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'include/modules') diff --git a/include/modules/cap.h b/include/modules/cap.h index 150393520..2336ef486 100644 --- a/include/modules/cap.h +++ b/include/modules/cap.h @@ -319,6 +319,17 @@ namespace Cap return ref->IsEnabled(user); return false; } + + /** Turn the capability on/off for a user. If the cap is not registered this method has no effect. + * @param user User to turn the cap on/off for + * @param val True to turn the cap on, false to turn it off + */ + void Set(User* user, bool val) + { + if (ref) + ref->Set(user, val); + } + }; class MessageBase : public ClientProtocol::Message -- cgit v1.3.1-10-gc9f91