Spreedme is not behaving well since I upgraded to version 12.
I cannot see the “Temporary Password” generation icon however if I type the link url /index.php/apps/spreedme/admin/tp , I will have access to the generation function.
The spreedme displays user1, user2 … instead of the real username . Prior to version 12 I could see the real username not user1…2…
The spreedme IOS application cannot login, return error sign in failed
so your /var/www/nextcloud/apps/spreedme/user.php
should look like this :
<?php
/**
* Nextcloud - spreedme
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Leon
* @copyright struktur AG 2016
*/
namespace OCA\SpreedME\User;
use OCA\SpreedME\Errors\ErrorCodes;
use OCA\SpreedME\Helper\Helper;
use OCA\SpreedME\Security\Security;
class User {
private $user;
public function __construct() {
$this->user = \OC::$server->getUserSession()->getUser();
}
public function requireLogin() {
if ($this->user === null) {
throw new \Exception('Not logged in', ErrorCodes::NOT_LOGGED_IN);
}
}
public function getInfo() {
return array(
'id' => $this->getUserId(),
'display_name' => $this->getDisplayName(),
'is_admin' => $this->isAdmin(),
'is_spreedme_admin' => $this->isSpreedMeAdmin(),
);
}
private function getUserId() {
$this->requireLogin();
if (Helper::getConfigValue('SPREED_WEBRTC_IS_SHARED_INSTANCE')) {
// Return cloud id instead
return $this->getCloudId();
}
return $this->user->getUID();
}
private function getUID() {
$this->requireLogin();
return $this->user->getUID();
}
private function getCloudId() {
$this->requireLogin();
if (!method_exists($this->user, 'getCloudId')) {
$uid = \OC::$server->getUserSession()->getUser()->getUID();
$server = \OC::$server->getURLGenerator()->getAbsoluteURL('/');
return $uid . '@' . rtrim(\OCA\Files_Sharing\Helper::removeProtocolFromUrl($server), '/');
}
// Nextcloud 9
return $this->user->getCloudId();
}
private function getDisplayName() {
$this->requireLogin();
return $this->user->getDisplayName();
}
private function getGroups() {
$this->requireLogin();
if (class_exists('\OC_Group', true)) {
// Nextcloud <= 11, ownCloud
return \OC_Group::getUserGroups($this->getUserId());
}
// Nextcloud >= 12
$groups = \OC::$server->getGroupManager()->getUserGroups(\OC::$server->getUserSession()->getUser());
return array_map(function ($group) {
return $group->getGID();
}, $groups);
}
private function isAdmin() {
$groups = $this->getGroups();
return in_array('admin', $groups, true);
}
private function isSpreedMeGroupAdmin() {
$groups = $this->getAdministeredGroups();
return in_array('Spreed.ME', $groups, true);
}
public function isSpreedMeAdmin() {
return $this->isAdmin() || $this->isSpreedMeGroupAdmin();
}
public function getSignedCombo() {
$id = $this->getUserId();
// Spreed WebRTC uses colons as a delimiter for the useridcombo.
// As the user id might contain colons (if it's a cloud id), we need to
// replace it with a non-valid URL character, e.g. a pipe (|).
// The reverse happens in the 'displayUserid' filter of owncloud.js
$id = str_replace(':', '|', $id);
return Security::getSignedCombo($id);
}
}
@leon thank you mine is 0.3.8 working perfectly fine now after I did the fixes.
is there any major changes except the user.php file ? it is worth upgrading now ?
@giorgio09 that’s a limitation of Nextcloud: Whenever you update an application, all additional files in it are lost.
That’s why there’s another way to configure the Spreed.ME app: Via the Admin Settings.
When configured via the Admin Settings (web interface), the settings remain across app upgrades and you don’t need to reconfigure it every time
With the changes made by @giorgio09 there are no more troubles with the logion for non admin users from the spreed.me iOS App.
In my setup I have defined a usergroup in Nextcloud “SpreedMe”. Every user of the “SpreedMe” group is also the admin for this usergroup. There is only one admin user in the administrator group of nextcloud that also belongs to the group of “SpreedMe”. I have defined that the spreedMe App in Nextcloud should be accessed only by the “SpreedMe” group.
With this setup only the admin user of Nextcloud can generate temporary passwords. Every other SpreedMe user without Nextcloud admin privilege can’t create temporary passwords (feature/button is not available in panel). Is this the normal behavior?
And I have another question regarding listing of room. In both apps (nextcloud spreedMe app/ spreedMe iOS app) you can define/create rooms. This works fine but I could not find a way to list the available (alreday created rooms) with the nextcloud spreedMe app.
please check config.php following line:
// Set to true if you want to allow access to this app + spreed-webrtc for non-registered users who received a temporary password by an Nextcloud admin.
// You can generate such a temporary password at: /index.php/apps/spreedme/admin/tp (Nextcloud admin user account required)
const OWNCLOUD_TEMPORARY_PASSWORD_LOGIN_ENABLED = true;
also make sure you have the following user.php
<?php
/**
* Nextcloud - spreedme
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Leon
* @copyright struktur AG 2016
*/
namespace OCA\SpreedME\User;
use OCA\SpreedME\Errors\ErrorCodes;
use OCA\SpreedME\Helper\Helper;
use OCA\SpreedME\Security\Security;
class User {
private $user;
public function __construct() {
$this->user = \OC::$server->getUserSession()->getUser();
}
public function requireLogin() {
if ($this->user === null) {
throw new \Exception('Not logged in', ErrorCodes::NOT_LOGGED_IN);
}
}
public function getInfo() {
return array(
'id' => $this->getUserId(),
'display_name' => $this->getDisplayName(),
'is_admin' => $this->isAdmin(),
'is_spreedme_admin' => $this->isSpreedMeAdmin(),
);
}
private function getUserId() {
$this->requireLogin();
if (Helper::getConfigValue('SPREED_WEBRTC_IS_SHARED_INSTANCE')) {
// Return cloud id instead
return $this->getCloudId();
}
return $this->user->getUID();
}
private function getUID() {
$this->requireLogin();
return $this->user->getUID();
}
private function getCloudId() {
$this->requireLogin();
if (!method_exists($this->user, 'getCloudId')) {
$uid = \OC::$server->getUserSession()->getUser()->getUID();
$server = \OC::$server->getURLGenerator()->getAbsoluteURL('/');
return $uid . '@' . rtrim(\OCA\Files_Sharing\Helper::removeProtocolFromUrl($server), '/');
}
// Nextcloud 9
return $this->user->getCloudId();
}
private function getDisplayName() {
$this->requireLogin();
return $this->user->getDisplayName();
}
private function getGroups() {
$this->requireLogin();
if (class_exists('\OC_Group', true)) {
// Nextcloud <= 11, ownCloud
return \OC_Group::getUserGroups($this->getUserId());
}
// Nextcloud >= 12
$groups = \OC::$server->getGroupManager()->getUserGroups(\OC::$server->getUserSession()->getUser());
return array_map(function ($group) {
return $group->getGID();
}, $groups);
}
private function getAdministeredGroups() {
$this->requireLogin();
if (class_exists('\OC_SubAdmin', true)) {
return \OC_SubAdmin::getSubAdminsGroups($this->getUserId());
}
// Nextcloud 9
$subadmin = new \OC\SubAdmin(
\OC::$server->getUserManager(),
\OC::$server->getGroupManager(),
\OC::$server->getDatabaseConnection()
);
$ocgroups = $subadmin->getSubAdminsGroups($this->user);
$groups = array();
foreach ($ocgroups as $ocgroup) {
$groups[] = $ocgroup->getGID();
}
return $groups;
}
private function isAdmin() {
$groups = $this->getGroups();
return in_array('admin', $groups, true);
}
private function isSpreedMeGroupAdmin() {
$groups = $this->getAdministeredGroups();
return in_array('Spreed.ME', $groups, true);
}
public function isSpreedMeAdmin() {
return $this->isAdmin() || $this->isSpreedMeGroupAdmin();
}
public function getSignedCombo() {
$id = $this->getUserId();
// Spreed WebRTC uses colons as a delimiter for the useridcombo.
// As the user id might contain colons (if it's a cloud id), we need to
// replace it with a non-valid URL character, e.g. a pipe (|).
// The reverse happens in the 'displayUserid' filter of owncloud.js
$id = str_replace(':', '|', $id);
return Security::getSignedCombo($id);
}
}
@leon Strange it returns that the user is not a admin of the Group Spreed.ME but as you can see from the early post user Demo is admin of the “Spreed.ME”.