Multiuser but single rTorrent? [SOLVED]

randac56

Member
May 25, 2018
915
0
16
I have a setup now where everyone logs in seperately.

But there is only one copy of rtorrent - we can all see and manage each other's torrents, and we like it that way (we share a lot of the same tastes, so it saves us from each downloading our own copy).

I love having separate permissions for each user for the plugins - for example, I only want a couple of us to manage the RSS feeds. But I still want the settings for each plugin saved globally.

For some plugins, like trafic, it just wastes cpu power recording the stats multiple times, once for each user.

But some plugins could cause some serious problems - like autotools running once per user on the same torrent.


Is there any way to save the settings globally, but still have per user permissions?
 

randac56

Member
May 25, 2018
915
0
16
A slight change to util.php seems to work nicely.

With this patch, the permissions and such (config.php, access.ini, plugins.ini) are loaded from the user specific directory. However, all the plugins see the username as blank, and all settings are stored in the global settings directory.

A new setting is added to config.php:

$forbidUserPermissions = false; // false means use per user config in ./rutorrent/conf/<username>/config.php. true means use global config in ./rutorrent/conf/config.php

Code:
Index: util.php
===================================================================
--- util.php (revision 1226)
+++ util.php (working copy)
@@ -247,7 +247,7 @@

function getConfFile($name)
{
- $user = getUser();
+ $user = getConfigUser();
if($user!='')
{
global $rootPath;
@@ -265,7 +265,7 @@
$conf = $rootPath.'/plugins/'.$plugin.'/conf.php';
if(is_file($conf) && is_readable($conf))
$ret.='require_once("'.$conf.'");';
- $user = getUser();
+ $user = getConfigUser();
if($user!='')
{
$conf = $rootPath.'/conf/users/'.$user.'/plugins/'.$plugin.'/conf.php';
@@ -281,6 +281,13 @@
return( (!$forbidUserSettings && isset($_SERVER['REMOTE_USER']) && !empty($_SERVER['REMOTE_USER'])) ? strtolower($_SERVER['REMOTE_USER']) : '' );
}

+function getConfigUser()
+{
+ // Patch by Grant Emsley
+ // returns the user for permissions ( stuff in conf/user/*)
+ return( (!$forbidUserPermissions && isset($_SERVER['REMOTE_USER']) && !empty($_SERVER['REMOTE_USER'])) ? strtolower($_SERVER['REMOTE_USER']) : '');
+}
+
function getProfilePath()
{
global $rootPath;
@@ -405,4 +412,4 @@
echo($content);
}

-?>
\ No newline at end of file
+?>
 

peshua19

Member
May 25, 2018
897
0
16
very nice ...

Do you think you can also make it so users can NOT manage other users torrents ?? Or only admins can.
As basicly then you have a kick-ass multi-user system like Torrentflux was long time ago.
 

lisas4567

Member
May 25, 2018
773
0
16
Quote
I have a setup now where everyone logs in seperately.

But there is only one copy of rtorrent - we can all see and manage each other's torrents, and we like it that way (we share a lot of the same tastes, so it saves us from each downloading our own copy).

I love having separate permissions for each user for the plugins - for example, I only want a couple of us to manage the RSS feeds. But I still want the settings for each plugin saved globally.

For some plugins, like trafic, it just wastes cpu power recording the stats multiple times, once for each user.

But some plugins could cause some serious problems - like autotools running once per user on the same torrent.


Is there any way to save the settings globally, but still have per user permissions?​


the only thing you really needed to do was:


create multiple user dirs in rutorrent/conf/users/, one for each user

set the scgi settings the same

add plugin.ini for each user enabling or disabling each plugin for each user

and for any plugins you wish to have seperate settings for, simply create a dir called plugins/ in the rutorrent/conf/users/USERNAME dir with the plugin name/conf

for example, 2 users joe and steve with different settings for rss might look like this:

rutorrent/conf/users/steve/plugins/rss/conf.php
rutorrent/conf/users/joe/plugins/rss/conf.php

the conf.php of course is a copy of the original one from plugins/rss/

no patching needed