Add authentication support (#185)
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
</table>
|
||||
|
||||
<script type="text/javascript">
|
||||
ajaxCall('/api/v1.0/Bios', 'GET', function (result) {
|
||||
ajaxCall('/api/v1.1/Bios', 'GET', function (result) {
|
||||
result.sort((a, b) => a.platformname.charCodeAt(0) - b.platformname.charCodeAt(0));
|
||||
|
||||
var lastPlatform = '';
|
||||
@@ -28,7 +28,7 @@
|
||||
}
|
||||
|
||||
var biosFilename = document.createElement('a');
|
||||
biosFilename.href = '/api/v1.0/Bios/' + result[i].platformid + '/' + result[i].filename;
|
||||
biosFilename.href = '/api/v1.1/Bios/' + result[i].platformid + '/' + result[i].filename;
|
||||
biosFilename.innerHTML = result[i].filename;
|
||||
biosFilename.className = 'romlink';
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
availableText.className = 'greentext';
|
||||
|
||||
biosFilename = document.createElement('a');
|
||||
biosFilename.href = '/api/v1.0/Bios/' + result[i].platformid + '/' + result[i].filename;
|
||||
biosFilename.href = '/api/v1.1/Bios/' + result[i].platformid + '/' + result[i].filename;
|
||||
biosFilename.innerHTML = result[i].filename;
|
||||
biosFilename.className = 'romlink';
|
||||
} else {
|
||||
|
@@ -26,7 +26,7 @@
|
||||
}
|
||||
|
||||
ajaxCall(
|
||||
'/api/v1.0/Logs' + apiQuery,
|
||||
'/api/v1.1/Logs' + apiQuery,
|
||||
'GET',
|
||||
function (result) {
|
||||
var newTable = document.getElementById('settings_events_table');
|
||||
|
@@ -6,7 +6,7 @@
|
||||
|
||||
<p>This list is pre-populated with some of the more common platforms. New platforms will appear in this list as titles are added.</p>
|
||||
|
||||
<p><button value="Export to JSON" onclick="DownloadJSON();">Export to JSON</button><button id="importjson" value="Import JSON">Import JSON</button><button value="Reset to Default" onclick="loadPlatformMapping(true);">Reset to Default</button></p>
|
||||
<p id="settings_mapping_import" style="display: none;"><button value="Export to JSON" onclick="DownloadJSON();">Export to JSON</button><button id="importjson" value="Import JSON">Import JSON</button><button value="Reset to Default" onclick="loadPlatformMapping(true);">Reset to Default</button></p>
|
||||
|
||||
<input id='uploadjson' type='file' name='files' hidden/>
|
||||
|
||||
@@ -15,6 +15,10 @@
|
||||
</table>
|
||||
|
||||
<script type="text/javascript">
|
||||
if (userProfile.roles.includes("Admin")) {
|
||||
document.getElementById('settings_mapping_import').style.display = '';
|
||||
}
|
||||
|
||||
function loadPlatformMapping(Overwrite) {
|
||||
var queryString = '';
|
||||
if (Overwrite == true) {
|
||||
@@ -22,7 +26,7 @@
|
||||
}
|
||||
|
||||
ajaxCall(
|
||||
'/api/v1.0/PlatformMaps' + queryString,
|
||||
'/api/v1.1/PlatformMaps' + queryString,
|
||||
'GET',
|
||||
function (result) {
|
||||
var newTable = document.getElementById('settings_mapping_table');
|
||||
@@ -47,8 +51,15 @@
|
||||
hasWebEmulator = 'Yes';
|
||||
}
|
||||
|
||||
var platformLink = '';
|
||||
if (userProfile.roles.includes("Admin")) {
|
||||
platformLink = '<a href="#/" onclick="ShowPlatformMappingDialog(' + result[i].igdbId + ');" class="romlink">' + result[i].igdbName + '</a>';
|
||||
} else {
|
||||
platformLink = result[i].igdbName;
|
||||
}
|
||||
|
||||
var newRow = [
|
||||
'<a href="#/" onclick="ShowPlatformMappingDialog(' + result[i].igdbId + ');" class="romlink">' + result[i].igdbName + '</a>',
|
||||
platformLink,
|
||||
result[i].extensions.supportedFileExtensions.join(', '),
|
||||
result[i].extensions.uniqueFileExtensions.join(', '),
|
||||
hasWebEmulator
|
||||
@@ -61,7 +72,7 @@
|
||||
}
|
||||
|
||||
function DownloadJSON() {
|
||||
window.open('/api/v1.0/PlatformMaps', '_blank');
|
||||
window.open('/api/v1.1/PlatformMaps', '_blank');
|
||||
}
|
||||
|
||||
document.getElementById('importjson').addEventListener('click', openDialog);
|
||||
@@ -71,7 +82,7 @@
|
||||
}
|
||||
|
||||
$('#uploadjson').change(function () {
|
||||
$(this).simpleUpload("/api/v1.0/PlatformMaps", {
|
||||
$(this).simpleUpload("/api/v1.1/PlatformMaps", {
|
||||
start: function (file) {
|
||||
//upload started
|
||||
console.log("JSON upload started");
|
||||
|
@@ -11,7 +11,7 @@
|
||||
<script type="text/javascript">
|
||||
function drawLibrary() {
|
||||
ajaxCall(
|
||||
'/api/v1.0/Library',
|
||||
'/api/v1.1/Library',
|
||||
'GET',
|
||||
function (result) {
|
||||
var newTable = document.getElementById('settings_libraries');
|
||||
|
@@ -26,7 +26,7 @@
|
||||
<div id="system_signatures"></div>
|
||||
|
||||
<script type="text/javascript">function SystemLoadStatus() {
|
||||
ajaxCall('/api/v1.0/BackgroundTasks', 'GET', function (result) {
|
||||
ajaxCall('/api/v1.1/BackgroundTasks', 'GET', function (result) {
|
||||
var newTable = document.createElement('table');
|
||||
newTable.className = 'romtable';
|
||||
newTable.setAttribute('cellspacing', 0);
|
||||
@@ -91,8 +91,10 @@
|
||||
var itemInterval = result[i].interval;
|
||||
var nextRunTime = moment(result[i].nextRunTime).fromNow();
|
||||
var startButton = '';
|
||||
if (result[i].allowManualStart == true && result[i].itemState != "Running") {
|
||||
startButton = "<span id='startProcess' class='romstart' onclick='StartProcess(\"" + result[i].itemType + "\");'>Start</span>";
|
||||
if (userProfile.roles.includes("Admin")) {
|
||||
if (result[i].allowManualStart == true && result[i].itemState != "Running") {
|
||||
startButton = "<span id='startProcess' class='romstart' onclick='StartProcess(\"" + result[i].itemType + "\");'>Start</span>";
|
||||
}
|
||||
}
|
||||
|
||||
if (result[i].allowManualStart == false && result[i].removeWhenStopped == true) {
|
||||
@@ -119,7 +121,7 @@
|
||||
}
|
||||
|
||||
function SystemLoadSystemStatus() {
|
||||
ajaxCall('/api/v1.0/System', 'GET', function (result) {
|
||||
ajaxCall('/api/v1.1/System', 'GET', function (result) {
|
||||
if (result) {
|
||||
var totalLibrarySpace = 0;
|
||||
|
||||
@@ -234,7 +236,7 @@
|
||||
}
|
||||
|
||||
function SystemSignaturesStatus() {
|
||||
ajaxCall('/api/v1.0/Signatures/Status', 'GET', function (result) {
|
||||
ajaxCall('/api/v1.1/Signatures/Status', 'GET', function (result) {
|
||||
var newTable = document.createElement('table');
|
||||
newTable.className = 'romtable';
|
||||
newTable.setAttribute('cellspacing', 0);
|
||||
@@ -257,7 +259,7 @@
|
||||
}
|
||||
|
||||
function StartProcess(itemType) {
|
||||
ajaxCall('/api/v1.0/BackgroundTasks/' + itemType + '?ForceRun=true', 'GET', function (result) {
|
||||
ajaxCall('/api/v1.1/BackgroundTasks/' + itemType + '?ForceRun=true', 'GET', function (result) {
|
||||
SystemLoadStatus();
|
||||
});
|
||||
}
|
||||
|
99
gaseous-server/wwwroot/pages/settings/users.html
Normal file
99
gaseous-server/wwwroot/pages/settings/users.html
Normal file
@@ -0,0 +1,99 @@
|
||||
<div id="gametitle">
|
||||
<h1 id="gametitle_label">Users</h1>
|
||||
</div>
|
||||
|
||||
<button id="settings_users_new" value="New User" style="float: right;" onclick="showSubDialog('settingsusernew');">New User</button>
|
||||
|
||||
<div id="settings_users_table_container">
|
||||
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
function GetUsers() {
|
||||
var targetDiv = document.getElementById('settings_users_table_container');
|
||||
targetDiv.innerHTML = '';
|
||||
|
||||
ajaxCall(
|
||||
'/api/v1.1/Account/Users',
|
||||
'GET',
|
||||
function(result) {
|
||||
var newTable = document.createElement('table');
|
||||
newTable.className = 'romtable';
|
||||
newTable.style.width = '100%';
|
||||
newTable.cellSpacing = 0;
|
||||
|
||||
newTable.appendChild(
|
||||
createTableRow(
|
||||
true,
|
||||
[
|
||||
'Email',
|
||||
'Role',
|
||||
'Age Restriction',
|
||||
''
|
||||
],
|
||||
'',
|
||||
''
|
||||
)
|
||||
);
|
||||
|
||||
for (var i = 0; i < result.length; i++) {
|
||||
var roleDiv = document.createElement('div');
|
||||
// for (var r = 0; r < result[i].roles.length; r++) {
|
||||
// var roleItem = document.createElement('div');
|
||||
// roleItem.className = 'dropdownroleitem';
|
||||
// roleItem.innerHTML = result[i].roles[r].toUpperCase();
|
||||
// var colorVal = intToRGB(hashCode(result[i].roles[r]));
|
||||
// roleItem.style.backgroundColor = '#' + colorVal;
|
||||
// roleItem.style.borderColor = '#' + colorVal;
|
||||
// roleDiv.appendChild(roleItem);
|
||||
// }
|
||||
|
||||
var roleItem = CreateBadge(result[i].highestRole);
|
||||
roleDiv.appendChild(roleItem);
|
||||
|
||||
var ageRestrictionPolicyDescription = document.createElement('div');
|
||||
if (result[i].securityProfile != null) {
|
||||
if (result[i].securityProfile.ageRestrictionPolicy != null) {
|
||||
var IncludeUnratedText = '';
|
||||
if (result[i].securityProfile.ageRestrictionPolicy.includeUnrated == true) {
|
||||
IncludeUnratedText = " + Unclassified titles";
|
||||
}
|
||||
|
||||
var restrictionText = result[i].securityProfile.ageRestrictionPolicy.maximumAgeRestriction + IncludeUnratedText;
|
||||
|
||||
ageRestrictionPolicyDescription = CreateBadge(restrictionText);
|
||||
}
|
||||
}
|
||||
|
||||
var editButton = '';
|
||||
|
||||
var deleteButton = '';
|
||||
|
||||
if (userProfile.userId != result[i].id) {
|
||||
editButton = '<a href="#" onclick="showDialog(\'settingsuseredit\', \'' + result[i].id + '\');" class="romlink"><img src="/images/edit.svg" class="banner_button_image" alt="Edit" title="Edit" /></a>';
|
||||
|
||||
deleteButton = '<a href="#" onclick="showSubDialog(\'settingsuserdelete\', \'' + result[i].id + '\');" class="romlink"><img src="/images/delete.svg" class="banner_button_image" alt="Delete" title="Delete" /></a>';
|
||||
}
|
||||
|
||||
newTable.appendChild(
|
||||
createTableRow(
|
||||
false,
|
||||
[
|
||||
result[i].emailAddress,
|
||||
roleDiv,
|
||||
ageRestrictionPolicyDescription,
|
||||
'<div style="text-align: right;">' + editButton + deleteButton + '</div>'
|
||||
],
|
||||
'romrow',
|
||||
'romcell'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
targetDiv.appendChild(newTable);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
GetUsers();
|
||||
</script>
|
Reference in New Issue
Block a user