1
0
mirror of https://github.com/spl0k/supysonic.git synced 2024-12-22 17:06:17 +00:00

Removed the ability to create the first user (admin) through the web interface

This commit is contained in:
spl0k 2013-09-23 11:46:06 +02:00
parent 9884fc10ea
commit 3ecd787895
3 changed files with 10 additions and 16 deletions

View File

@ -86,11 +86,13 @@ With that kind of configuration, the server address will look like *http://serve
Quickstart
----------
The first time you run the server, open its URL to set the initial configuration. You'll be asked to create
a first user. This user will be an admin of the server.
To start using Supysonic, you'll first have to specify where your music library is located and create a user
to allow calls to the API.
Once the first user created, log in to the app. Then you can add other users or manage folders. Folders are
where your music is located. Add one, then hit the scan button. The scanning process might take some time on
large libraries, so be patient. Your browser might even timeout even if the process is still running. Once
scanning is done, you can enjoy your music with the client of your choice.
Let's start by creating the user. To do so, use the
[command-line interface](https://github.com/spl0k/supysonic/wiki/Command-Line-Interface) (`cli.py`).
For the folder(s) (music library) you can either use the CLI, or go to the web interface if you gave admin
rights to the user. Once the folder is created, don't forget to scan it to build the music database (it might
take a while depending on your library size, so be patient). Once scanning is done, you can enjoy your music
with the client of your choice.

View File

@ -14,9 +14,6 @@ def check_admin():
if not request.path.startswith('/user'):
return
if request.endpoint == 'add_user' and User.query.filter(User.admin == True).count() == 0:
return
if request.endpoint in ('user_index', 'add_user', 'del_user', 'export_users', 'import_users', 'do_user_import') and not UserManager.get(session.get('userid'))[1].admin:
return redirect(url_for('index'))

9
web.py
View File

@ -17,16 +17,11 @@ import db
from managers.user import UserManager
@app.before_request
def init_and_login_check():
def login_check():
if request.path.startswith('/rest/'):
return
admin_count = db.User.query.filter(db.User.admin == True).count()
if admin_count == 0 and request.endpoint != 'add_user':
flash('Not configured. Please create the first admin user')
return redirect(url_for('add_user'))
if not (admin_count == 0 and request.endpoint == 'add_user') and request.endpoint != 'login':
if request.endpoint != 'login':
should_login = False
if not session.get('userid'):
should_login = True