diff --git a/objects/user.php b/objects/user.php index 470af04dda..06ca47da06 100644 --- a/objects/user.php +++ b/objects/user.php @@ -2571,11 +2571,12 @@ if (typeof gtag !== \"function\") { public static function canCreateMeet() { - global $global, $config; - if (self::isLogged() && !empty($_SESSION['user']['canCreateMeet'])) { - return true; + $p = AVideoPlugin::isEnabledByName('Meet'); + if(empty($p)){ + return false; } - return self::isAdmin(); + + return Meet::canCreateMeet(); } public static function canComment() diff --git a/plugin/Meet/Meet.php b/plugin/Meet/Meet.php index a42e82918e..cdace85173 100644 --- a/plugin/Meet/Meet.php +++ b/plugin/Meet/Meet.php @@ -15,6 +15,8 @@ User::loginFromRequestIfNotLogged(); //use \Firebase\JWT\JWT; class Meet extends PluginAbstract { + const PERMISSION_CAN_CREATE_MEET = 0; + public function getTags() { return [ @@ -694,4 +696,26 @@ Passcode: {password} $buttonTitle = $obj->buttonTitle; include $global['systemRootPath'] . 'plugin/Meet/getUploadMenuButton.php'; } + + function getPermissionsOptions() + { + $permissions = array(); + + $permissions[] = new PluginPermissionOption(self::PERMISSION_CAN_CREATE_MEET, __("Can create meetings"), "Members of the designated user group will have access create meetings", 'Meet'); + return $permissions; + } + + static function canCreateMeet() + { + + if (User::isAdmin() || isCommandLineInterface()) { + return true; + } + + if(!User::isLogged()){ + return false; + } + + return !empty($_SESSION['user']['canCreateMeet']) || Permissions::hasPermission(self::PERMISSION_CAN_CREATE_MEET, 'Meet'); + } }