Documentation

How-tos / How to implement user specific paths

The easiest way to do this, is by using the SessionAuthenticator, read more about it in the integration section.

Using the session authenticator, you can set specific paths depending on who logs into your system, this is a simple example on how to use this feature.

// Setup sessions on login of your CMS (or the example login page that comes with the software)
session_start();
$user = $_SESSION["userid"]; // Get a userid or name from your system
$_SESSION['isLoggedIn']=true; // Set the state for the Session Authenticator

// Override the rootpath
$_SESSION['filesystem.rootpath']="/var/www/htdocs/mysite.com/". $user ."/files/";

Sanitize the $user variable, MoxieManager does have checks against hack attempts, but its always a good idea to sanitize the input.

 Alternative

There is an alternative that is supported by a few of our authenticators, the ${user} replacement.

First, you need to make sure you set the "user key" for that authenticator, so for the SessionAuthenticator that would be whatever you configure the sessionauthenticator.user_key to be. If you configure that to "username" and then set a session called "username" to the name of that user (or ID), it will make that part of the path.

You can configure your config.php/Web.config rootpath to something like c:/Inetpub/wwwroot/project/${user}/imagesand the ${user} will be replaced with the user key.

Be sure to sanitize this as much as possible before setting it.

This feature is supported by the Externalauthenticator, SessionAuthenticator and for .NET we also have support for it in the AspNetAuthenticator.