From dcae922075ac9621ee5bc187cebed125e9cffec4 Mon Sep 17 00:00:00 2001 From: Richard Underwood Date: Tue, 7 Nov 2017 11:28:03 +0000 Subject: [PATCH] Uncommitted changes - mostly permissions dor admin user. --- README.md | 2 +- includes/permissions.inc.php | 3 +- index.php | 71 +++++++++++++++++++++++++++++++++++- 3 files changed, 72 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 2758077..44e34dc 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Features User support ============ Multiple users are supported. A user can be an admin or a normal user. You can -configure wheter or not a normal user is allowed to add new zones. +configure whether or not a normal user is allowed to add new zones. WeFact Login support ==================== diff --git a/includes/permissions.inc.php b/includes/permissions.inc.php index 805899a..3869863 100644 --- a/includes/permissions.inc.php +++ b/includes/permissions.inc.php @@ -85,7 +85,7 @@ function set_permissions($userid,$groupid,$zone,$permissions) { writelog("Added '$permissionmap[$permissions]' permissions for $who from zone $zone."); return $db->lastInsertRowID(); } else { - writelog("Failed to add permissions to zone $zone ($zoneid) for $who."); + writelog("Failed to add permissions to zone $zone for $who."); return null; } } @@ -209,7 +209,6 @@ function permissions($zone,$userid) { } $perm=user_permissions($zone,$userid); - if(!is_null($perm)) { return $perm; } else { diff --git a/index.php b/index.php index cf064b5..81acdda 100644 --- a/index.php +++ b/index.php @@ -469,6 +469,75 @@ $(document).ready(function () { return $img; } }, + + permissions: { + title: 'Permissions', + width: '10%', + create: false, + edit: false, + display: function(data) { + var $img = $(''); + $img.click(function () { + $('#SlaveZones').jtable('openChildTable', + $img.closest('tr'), { + title: 'Permissions for ' + data.record.name, + openChildAsAccordion: true, + actions: { + listAction: 'permissions.php?action=list&zoneid=' + data.record.id, + createAction: 'permissions.php?action=add&zoneid=' + data.record.id, + updateAction: 'permissions.php?action=update&zoneid=' + data.record.id, + deleteAction: 'permissions.php?action=remove&zoneid=' + data.record.id + }, + fields: { + id: { + key: true, + type: 'hidden' + }, + type: { + title: 'Type', + inputClass: "permissionstype", + options: { + 'user': 'User', + 'group': 'Group' + }, + create: true, + edit: false + }, + value: { + title: 'Name', + inputClass: "usergrouplist", + display: displayContent('value'), + create: true, + edit: false + }, + permissions: { + title: 'Permissions', + options: { + '0' : 'No permissions', + '1' : 'View Only', + '15' : 'Admin' + } + } + }, + formCreated: function(event, dat) { + $( ".usergrouplist" ).autocomplete({ + source: "permissions.php?action=autocomplete&type=" + $( ".permissionstype" ).val() + }); + $( ".permissionstype" ).change(function() { + $( ".usergrouplist" ).val(""); + $( ".usergrouplist" ).autocomplete({ + source: "permissions.php?action=autocomplete&type=" + $( ".permissionstype" ).val() + }); + }); + } + }, function (data) { + data.childTable.jtable('load'); + }) + }); + return $img; + } + }, + exportzone: { title: '', width: '1%', @@ -817,7 +886,7 @@ $(document).ready(function () { display: function(data) { var $img = $(''); $img.click(function () { - $('#SlaveZones').jtable('openChildTable', + $('#MasterZones').jtable('openChildTable', $img.closest('tr'), { title: 'Permissions for ' + data.record.name, openChildAsAccordion: true,