Skip to main content

User Logins

Users allows you to create multiple logins with different permissions and per-user config options. For example, you might want to have a public gallery without login and an admin-user with login that can upload and manage files. Or maybe you want to create multiple users, each with access to different root directories.

beta

User logins in Files Gallery 0.11.0 is currently beta and more features will be added shortly, including an interface to manage users and user-settings, config option to allow user management, custom javascript, CSS and includes per user and translated login page.

Usage Examples

  • Allow public (non-login) view access while allowing admin login for file manager actions.
  • Create multiple users each assigned to different root folders.
  • Assign different permissions and config options per user.

Users Demo

A few examples of different user logins username / password.
demo.files.gallery/users
*For each login example, you will need to first logout from the topbar.

  • guest / guest
    Default public login with view only permissions.
  • admin / abracadabra
    Admin user with all file manager capabilities allowed.
  • galleries / aurora
    Users config root assigned to galleries dir with full permissions.
  • user / elixir
    Menu disabled, a few dirs excluded and language assigned to German.

Instructions

The concept is simple. Create dir _files/users/username with user config.php inside.

_files
├── cache
├── config
└── users
├── usernameA
│ └── config.php
├── usernameB
│ └── config.php
└── usernameC
└── config.php

You can include any config option in the user config file, which will override options you have in your main _files/config/config.php file. Minimal user config file would look like this:

<?php
return array (
'password' => 'elixir', // password is required (non-encrypted for demonstration purpose)
);

You may of course extend the user config with additional config options:

<?php
return array (
'root' => './galleries', // assign a different root directory for this user
'password' => 'elixir', // password *required (non-encrypted for demonstration purpose)
'allow_all' => true, // this user has full permissions for upload, move, copy, delete etc
'dirs_exclude' => '/^(files|tests)(\/|$)/', // exclude a few dir paths for this user
'menu_enabled' => false, // disable the main menu for this user
'lang_default' => 'de', // German language for this user
'lang_auto' => false, // force default language instead of assigning from browser
);

The user config file should only contain the minimal amount of config options that differ from your default _files/config/config.php options which otherwise are inherited.

Required Login vs Optional Login

You may want to make login mandatory or you may want to allow public (non-login access) while allowing optional login. If your default _files/config/config.php contains username and password, login will be required. Otherwise it will be optional.

Required Login

Login is mandatory when username and password is assigned in your _files/config/config.php You can still create additional users with different permissions and settings.

Optional Login

Login is optional when username and password in your default _files/config/config.php is empty. In this case, a login button will appear in the topbar, allowing users to login.

Getting Started Example

Although there will soon be an interface to manage users, here is a basic tutorial:

  1. Create the users dir _files/users in your storage path.
  2. Create a dir with the username you want to use _files/users/usernameA
  3. Create the config file _files/users/usernameA/config.php and copy-paste the below.
<?php
return array (
//'root' => '',
//'root_url_path' => '',
//'start_path' => '',
'password' => 'abcd1234',
);

Login as usernameA abcd1234 and apply additional config options if required.

FAQ

  • Can I encrypt passwords?
    Yes, you can use this tool to encrypt your passwords. Although you can use non-encrypted passwords, it's normally good practice to encrypt your passwords. In a future release, passwords will automatically be encrypted when created from the user management interface.
  • Can I use duplicate usernames?
    No. Usernames must be unique, because they are used to identify users and store settings.
  • Can I assign which folders each user has permission to view and edit?
    No. Files Gallery is not a CMS, and you can't assign user permissions on a per-folder basis. You can however use config options dirs_exclude and files_exclude in user configs to hide certain dirs and files for each user and the root option will of course decide the users root folder.
  • Can I hide the login button if there is only one login?
    Yes, and this is recommended if you are the only one who is supposed to be able to login, as it will hide the login page. Instead, you can login by url ?login=1 and hide the login-button by adding the below to your custom.css:
#login-button {
display: none;
}

If you have questions or feedback about users, please post in the support forums.