Add global allow guest access setting and per user toggles

This commit is contained in:
JonnyWong16 2016-04-23 21:43:10 -07:00
commit 62600a450a
7 changed files with 56 additions and 15 deletions

View file

@ -20,6 +20,7 @@ is_allow_sync Returns bool value for whether the user has sync rights.
is_restricted Returns bool value for whether the user account is restricted.
do_notify Returns bool value for whether to send notifications for the user.
keep_history Returns bool value for whether to keep history for the user.
allow_guest Returns bool value for whether to allow guest access for the user.
DOCUMENTATION :: END
</%doc>
@ -67,6 +68,12 @@ DOCUMENTATION :: END
</label>
<p class="help-block">Uncheck this if you do not want to keep any history on this user's activity.</p>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="allow_guest" name="allow_guest" value="1" ${helpers.checked(data['allow_guest'])}> Allow Guest Access
</label>
<p class="help-block">Uncheck this if you do not want to allow this user to login to PlexPy.</p>
</div>
% if data['user_id']:
<div class="form-group">
<button class="btn btn-danger" id="delete-all-history">Purge</button>
@ -108,12 +115,16 @@ DOCUMENTATION :: END
var custom_thumb = $("#custom_avatar_url").val();
var do_notify = 0;
var keep_history = 0;
var allow_guest = 0;
if ($("#do_notify").is(":checked")) {
do_notify = 1;
}
if ($("#keep_history").is(":checked")) {
keep_history = 1;
}
if ($("#allow_guest").is(":checked")) {
allow_guest = 1;
}
$.ajax({
url: 'edit_user',
@ -122,7 +133,8 @@ DOCUMENTATION :: END
friendly_name: friendly_name,
custom_thumb: custom_thumb,
do_notify: do_notify,
keep_history: keep_history
keep_history: keep_history,
allow_guest: allow_guest
},
cache: false,
async: true,

View file

@ -45,6 +45,7 @@ users_list_table_options = {
'<button class="btn btn-xs btn-warning purge-user" data-id="' + rowData['user_id'] + '" data-toggle="button"><i class="fa fa-eraser fa-fw"></i> Purge</button>&nbsp&nbsp&nbsp' +
'<input type="checkbox" id="do_notify-' + rowData['user_id'] + '" name="do_notify" value="1" ' + rowData['do_notify'] + '><label class="edit-tooltip" for="do_notify-' + rowData['user_id'] + '" data-toggle="tooltip" title="Toggle Notifications"><i class="fa fa-bell fa-lg fa-fw"></i></label>&nbsp' +
'<input type="checkbox" id="keep_history-' + rowData['user_id'] + '" name="keep_history" value="1" ' + rowData['keep_history'] + '><label class="edit-tooltip" for="keep_history-' + rowData['user_id'] + '" data-toggle="tooltip" title="Toggle History"><i class="fa fa-history fa-lg fa-fw"></i></label>&nbsp' +
'<input type="checkbox" id="allow_guest-' + rowData['user_id'] + '" name="allow_guest" value="1" ' + rowData['allow_guest'] + '><label class="edit-tooltip" for="allow_guest-' + rowData['user_id'] + '" data-toggle="tooltip" title="Allow Guest Access"><i class="fa fa-unlock-alt fa-lg fa-fw"></i></label>&nbsp' +
'</div>');
},
"width": "7%",
@ -300,12 +301,16 @@ $('#users_list_table').on('change', 'td.edit-control > .edit-user-toggles > inpu
var do_notify = 0;
var keep_history = 0;
var allow_guest = 0;
if ($('#do_notify-' + rowData['user_id']).is(':checked')) {
do_notify = 1;
}
if ($('#keep_history-' + rowData['user_id']).is(':checked')) {
keep_history = 1;
}
if ($('#allow_guest-' + rowData['user_id']).is(':checked')) {
allow_guest = 1;
}
friendly_name = tr.find('td.edit-user-control > .edit-user-name > input').val();
@ -316,6 +321,7 @@ $('#users_list_table').on('change', 'td.edit-control > .edit-user-toggles > inpu
friendly_name: friendly_name,
do_notify: do_notify,
keep_history: keep_history,
allow_guest: allow_guest,
thumb: rowData['user_thumb']
},
cache: false,

View file

@ -520,6 +520,16 @@ available_notification_agents = sorted(notifiers.available_notification_agents()
data-parsley-errors-container="#http_hash_password_error" data-parsley-error-message="Cannot un-hash password, please set a new password." data-parsley-no-focus required>
<div class="padded-header">
<h3>Guest Access</h3>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="allow_guest_access" name="allow_guest_access" value="1" ${config['allow_guest_access']}> Allow Guest Access to PlexPy
</label>
<p class="help-block">Allow shared users to login to PlexPy using their Plex.tv account.</p>
</div>
<div class="padded-header">
<h3>API</h3>
</div>