Nextcloud 12.0.0.29 and SpreedMe

SpreedMe worked great with Nextcloud 11.
I get this error after upgrade to NC12:

Error index Error: Class ‘OC_Group’ not found
/var/www/nextcloud/apps/spreedme/user/user.php - line 112: OCA\SpreedME\User\User->getGroups()
/var/www/nextcloud/apps/spreedme/user/user.php - line 36: OCA\SpreedME\User\User->isAdmin()
/var/www/nextcloud/apps/spreedme/controller/apicontroller.php - line 65: OCA\SpreedME\User\User->getInfo()
[internal function] OCA\SpreedME\Controller\ApiController->getUserConfig()
/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 160: call_user_func_array(Array, Array)
/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 90: OC\AppFramework\Http\Dispatcher->executeController(Object(OCA\SpreedME\Controller\ApiController), ‘getUserConfig’)
/var/www/nextcloud/lib/private/AppFramework/App.php - line 114: OC\AppFramework\Http\Dispatcher->dispatch(Object(OCA\SpreedME\Controller\ApiController), ‘getUserConfig’)
/var/www/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php - line 47: OC\AppFramework\App main(‘OCA\SpreedME\Co…’, ‘getUserConfig’, Object(OC\AppFramework\DependencyInjection\DIContainer), Array)
[internal function] OC\AppFramework\Routing\RouteActionHandler->__invoke(Array)
/var/www/nextcloud/lib/private/Route/Router.php - line 299: call_user_func(Object(OC\AppFramework\Routing\RouteActionHandler), Array)
/var/www/nextcloud/lib/base.php - line 1000: OC\Route\Router->match(’/apps/spreedme/…’)
/var/www/nextcloud/index.php - line 40: OC handleRequest()
{main}

it seams so that spreedMe does not manage to connect to NC user groups.

I have the same issue here. Also option to create temp password disappeared even for nc admins.

Mine has the temp password disappeared and does not show real names. Only user1 , 2… Also not stable.

Hello Problem solved.
you need to follow this link : https://github.com/strukturag/nextcloud-spreedme/commit/9e84b8a20c28bd6a64ab7d8fa0675971471732f4?diff=unified

so your /var/www/nextcloud/apps/spreedme/user/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);
	}

}

1 Like

This worked @giorgio09 !! Thanks for this.

Also, I noticed the actual path to the file is one more level down in the “user” folder at:

/var/www/nextcloud/apps/spreedme/user/user.php

I modified the user.php in …/apps/spreedme/user as follows:

After a reboot of the server, my user are still shown as “Teilnehmer 1” (user1)

Same with my User Account it’s shown as “ich” (me)

Any ideas? I used a new downloaded Versoin of SpreedME 0.3.8
I’ve created new credentials / secrets and entered them into the /etc/spreed/webrtc.conf file.

SpreedMe starts and still shows users as mentioned above …

I figured out that the rights of the spreedme folder have been not properly configured after the new installation.

After using the script for settig the rwx Parameters and groups (www-data) the SpreedMe App is working as expected

:slight_smile:

@chrissi55 yes it has something to do with the ownership rights.
In fact I was trying to replicate your error and well enough users with no admin rights will not be displayed correctly.
could you please share the command you executed to put things in order ?
I have the solution however since you solved it I would like to hear that prior to posting mine.

On a side note: in your post there are misleading information and I urge you and others not to post such vague replies.
We respect your decision if you do not wish to share your solution with others however to post a vague and misleading info that is not nice.

As far as I know there are no scripts for chmod nor chown. those are simple and single line commands and has nothing to do with this particular problem. (this is the misleading info you provided)

For those who wish to know these commands :

find /var/www/nextcloud -type f -print0 | xargs -0 chmod 0640
find /var/www/nextcloud -type d -print0 | xargs -0 chmod 0750
chown -R www-data:www-data /var/www/nextcloud/apps/spreedme

By the way the spreedme could be with owner root and still work, I can demonstrate that if you wish, Yet I will give you the benefit of the doubt to post your solution on this forum just to prove me wrong and I will be more than happy and receptive to that.

Thank you.

@giorgio09: Many thanks now spreedme is (partially) working after using the comands you specified for chmod. Only the generate temporary password functionality is not available for those users who have not admin rights on nextcloud server.

In NC 11.x.x the solution was to define a user group “Spreed.Me”. This is not working anymore with NC12.0. Also if one user is using the spreedme app for iOS he can’t login anymore, until he is granted with admin rights for the nextcloud.

Is there some other solution for that?

yes there is a solution. I am just waiting a bit to further test.

The Script I used was

I only modified the Script for my setting (data folder e.g.)

…so there IS a Script for changing the Nextcoud Folder Permissions (still valid for the NC 12.x Versions …)
https://docs.nextcloud.com/server/9.0/admin_manual/installation/installation_wizard.html#setting-strong-directory-permissions

“The easy way to set the correct permissions is to copy and run this script. Replace the ncpath variable with the path to your Nextcloud directory, and replace the htuser and htgroup variables with your HTTP user and group:…”

@chrissi55
That is good but not the solution. Anyway the problem was solved by @leon with an upgrade for spreed.me

Spreedme not behaving well, after upgrade to Nextcloud 12