diff --git a/supysonic/frontend/__init__.py b/supysonic/frontend/__init__.py
index 1889d97..d5e5778 100644
--- a/supysonic/frontend/__init__.py
+++ b/supysonic/frontend/__init__.py
@@ -31,7 +31,7 @@ def login_check():
return
if request.path.startswith('/static/'):
- return
+ return
if request.endpoint != 'login':
should_login = False
diff --git a/supysonic/frontend/folder.py b/supysonic/frontend/folder.py
index 5a40ed1..83983b5 100644
--- a/supysonic/frontend/folder.py
+++ b/supysonic/frontend/folder.py
@@ -38,12 +38,12 @@ def check_admin():
@app.route('/folder')
def folder_index():
- return render_template('folders.html', folders = store.find(Folder, Folder.root == True))
+ return render_template('folders.html', folders = store.find(Folder, Folder.root == True), admin = UserManager.get(store, session.get('userid'))[1].admin)
@app.route('/folder/add', methods = [ 'GET', 'POST' ])
def add_folder():
if request.method == 'GET':
- return render_template('addfolder.html')
+ return render_template('addfolder.html', admin = UserManager.get(store, session.get('userid'))[1].admin)
error = False
(name, path) = map(request.form.get, [ 'name', 'path' ])
@@ -54,12 +54,12 @@ def add_folder():
flash('The path is required.')
error = True
if error:
- return render_template('addfolder.html')
+ return render_template('addfolder.html', admin = UserManager.get(store, session.get('userid'))[1].admin)
ret = FolderManager.add(store, name, path)
if ret != FolderManager.SUCCESS:
flash(FolderManager.error_str(ret))
- return render_template('addfolder.html')
+ return render_template('addfolder.html', admin = UserManager.get(store, session.get('userid'))[1].admin)
flash("Folder '%s' created. You should now run a scan" % name)
diff --git a/supysonic/frontend/user.py b/supysonic/frontend/user.py
index dfb2213..6c112b6 100644
--- a/supysonic/frontend/user.py
+++ b/supysonic/frontend/user.py
@@ -37,12 +37,12 @@ def check_admin():
@app.route('/user')
def user_index():
- return render_template('users.html', users = store.find(User))
+ return render_template('users.html', users = store.find(User), admin = UserManager.get(store, session.get('userid'))[1].admin)
@app.route('/user/me')
def user_profile():
prefs = store.find(ClientPrefs, ClientPrefs.user_id == uuid.UUID(session.get('userid')))
- return render_template('profile.html', user = UserManager.get(store, session.get('userid'))[1], api_key = config.get('lastfm', 'api_key'), clients = prefs)
+ return render_template('profile.html', user = UserManager.get(store, session.get('userid'))[1], api_key = config.get('lastfm', 'api_key'), clients = prefs, admin = UserManager.get(store, session.get('userid'))[1].admin)
@app.route('/user/me', methods = [ 'POST' ])
def update_clients():
@@ -74,7 +74,7 @@ def change_mail():
store.commit()
return redirect(url_for('user_profile'))
- return render_template('change_mail.html', user = user)
+ return render_template('change_mail.html', user = user, admin = UserManager.get(store, session.get('userid'))[1].admin)
@app.route('/user/changepass', methods = [ 'GET', 'POST' ])
def change_password():
@@ -99,15 +99,15 @@ def change_password():
flash('Password changed')
return redirect(url_for('user_profile'))
- return render_template('change_pass.html', user = UserManager.get(store, session.get('userid'))[1].name)
+ return render_template('change_pass.html', user = UserManager.get(store, session.get('userid'))[1].name, admin = UserManager.get(store, session.get('userid'))[1].admin)
@app.route('/user/add', methods = [ 'GET', 'POST' ])
def add_user():
if request.method == 'GET':
- return render_template('adduser.html')
+ return render_template('adduser.html', admin = UserManager.get(store, session.get('userid'))[1].admin)
error = False
- (name, passwd, passwd_confirm, mail, admin) = map(request.form.get, [ 'name', 'passwd', 'passwd_confirm', 'mail', 'admin' ])
+ (name, passwd, passwd_confirm, mail, admin) = map(request.form.get, [ 'user', 'passwd', 'passwd_confirm', 'mail', 'admin' ])
if name in (None, ''):
flash('The name is required.')
error = True
@@ -154,12 +154,12 @@ def export_users():
@app.route('/user/import')
def import_users():
- return render_template('importusers.html')
+ return render_template('importusers.html', admin = UserManager.get(store, session.get('userid'))[1].admin)
@app.route('/user/import', methods = [ 'POST' ])
def do_user_import():
if not request.files['file']:
- return render_template('importusers.html')
+ return render_template('importusers.html', admin = UserManager.get(store, session.get('userid'))[1].admin)
users = []
reader = csv.reader(request.files['file'])
diff --git a/supysonic/static/css/supysonic.css b/supysonic/static/css/supysonic.css
index c7a6613..27c5101 100644
--- a/supysonic/static/css/supysonic.css
+++ b/supysonic/static/css/supysonic.css
@@ -26,6 +26,14 @@ body {
margin-bottom: 0px;
}
+#adduserform label {
+ margin-bottom: 0;
+}
+
+#clients td {
+ vertical-align: middle;
+}
+
.page-header {
margin-top: 20px;
}
diff --git a/supysonic/templates/addfolder.html b/supysonic/templates/addfolder.html
index e958792..b251670 100644
--- a/supysonic/templates/addfolder.html
+++ b/supysonic/templates/addfolder.html
@@ -18,10 +18,30 @@
along with this program. If not, see
Name | Path | ||
---|---|---|---|
{{ folder.name }} | {{ folder.path }} | X | -Scan | -
Name | Path | ||
---|---|---|---|
{{ folder.name }} | {{ folder.path }} | + + | ++ | +
Warning: this will overwrite any existing users, even you!
+