Finish flag work on kick functionality.

This commit is contained in:
Kalila L 2021-03-17 23:25:08 -04:00
parent 0216b34681
commit be0bd3940d
3 changed files with 14 additions and 10 deletions

View file

@ -50,6 +50,7 @@
#include <shared/ConicalViewFrustum.h>
#include <shared/FileLogger.h>
#include <RunningMarker.h>
#include <ModerationFlags.h>
#include "avatar/MyAvatar.h"
#include "FancyCamera.h"
@ -608,7 +609,7 @@ private:
void toggleTabletUI(bool shouldOpen = false) const;
bool shouldCaptureMouse() const;
void userKickConfirmation(const QUuid& nodeID, int banFlags);
void userKickConfirmation(const QUuid& nodeID, int banFlags = ModerationFlags::getDefaultBanFlags());
MainWindow* _window;
QElapsedTimer& _sessionRunTimer;

View file

@ -41,10 +41,10 @@ class UsersScriptingInterface : public QObject, public Dependency {
Q_PROPERTY(bool canKick READ getCanKick)
Q_PROPERTY(bool requestsDomainListData READ getRequestsDomainListData WRITE setRequestsDomainListData)
Q_PROPERTY(unsigned int NO_BAN READ ModerationFlags::BanFlags::NO_BAN CONSTANT)
Q_PROPERTY(unsigned int BAN_BY_USERNAME READ ModerationFlags::BanFlags::BAN_BY_USERNAME CONSTANT)
Q_PROPERTY(unsigned int BAN_BY_FINGERPRINT READ ModerationFlags::BanFlags::BAN_BY_FINGERPRINT CONSTANT)
Q_PROPERTY(unsigned int BAN_BY_IP READ ModerationFlags::BanFlags::BAN_BY_IP CONSTANT)
Q_PROPERTY(unsigned int NO_BAN READ getNoBan CONSTANT)
Q_PROPERTY(unsigned int BAN_BY_USERNAME READ getBanByUsername CONSTANT)
Q_PROPERTY(unsigned int BAN_BY_FINGERPRINT READ getBanByFingerprint CONSTANT)
Q_PROPERTY(unsigned int BAN_BY_IP READ getBanByIP CONSTANT)
public:
UsersScriptingInterface();
@ -123,11 +123,9 @@ public slots:
* <p>This function only works if you're an administrator of the domain you're in.</p>
* @function Users.kick
* @param {Uuid} sessionID - The session ID of the user to kick and ban.
* @param {boolean} [banByUsername=true] - Should ban the user's username.
* @param {boolean} [banByFingerprint=true] - Should ban the user's machine fingerprint.
* @param {boolean} [banByIP=false] - Should ban the user's IP address.
* @param {number} - Preferred ban flags. <i>Bans a user by username (if available) and machine fingerprint by default.</i>
*/
void kick(const QUuid& nodeID, int banFlags = 0);
void kick(const QUuid& nodeID, int banFlags = ModerationFlags::getDefaultBanFlags());
/**jsdoc
* Mutes a user's microphone for everyone. The mute is not permanent: the user can unmute themselves.
@ -247,6 +245,11 @@ private:
bool getRequestsDomainListData();
void setRequestsDomainListData(bool requests);
static constexpr unsigned int getNoBan() { return ModerationFlags::BanFlags::NO_BAN; };
static constexpr unsigned int getBanByUsername() { return ModerationFlags::BanFlags::BAN_BY_USERNAME; };
static constexpr unsigned int getBanByFingerprint() { return ModerationFlags::BanFlags::BAN_BY_FINGERPRINT; };
static constexpr unsigned int getBanByIP() { return ModerationFlags::BanFlags::BAN_BY_IP; };
std::function<void(const QUuid& nodeID, int banFlags)> _kickConfirmationOperator;
ReadWriteLockable _kickResponseLock;

View file

@ -22,7 +22,7 @@ public:
BAN_BY_IP = 4
};
int test(int lol) { return lol; };
static constexpr unsigned int getDefaultBanFlags() { return (BanFlags::BAN_BY_USERNAME | BanFlags::BAN_BY_FINGERPRINT); };
};
#endif // vircadia_ModerationFlags_h