properly display permissions

This commit is contained in:
botanic 2014-09-08 04:55:05 -07:00
parent 4f907c30e6
commit 32745a132b
3 changed files with 38 additions and 22 deletions

View file

@ -34,7 +34,7 @@ class Helpers {
$smarty -> setCacheDir( $AMS_CACHEDIR ); $smarty -> setCacheDir( $AMS_CACHEDIR );
$smarty -> setConfigDir( $SITEBASE . '/configs/' ); $smarty -> setConfigDir( $SITEBASE . '/configs/' );
// turn smarty debugging on/off // turn smarty debugging on/off
$smarty -> debugging = false; $smarty -> debugging = true;
// caching must be disabled for multi-language support // caching must be disabled for multi-language support
$smarty -> caching = false; $smarty -> caching = false;
$smarty -> cache_lifetime = 300; $smarty -> cache_lifetime = 300;

View file

@ -76,10 +76,14 @@ function domain_management_hook_get_db()
if (isset($_GET['edit_domain'])){ if (isset($_GET['edit_domain'])){
//get permissions //get permissions
$statement = $db->executeWithoutParams("SELECT * FROM `permission` WHERE `DomainId` = '".$rows[$_GET['edit_domain']-1]['domain_name']."'"); $statement = $db->executeWithoutParams("SELECT * FROM `domain` WHERE `domain_id` = '".$_GET['edit_domain']."'");
$rows = $statement->fetchAll();
$domain_management_return_set['domains'] = $rows;
$statement = $db->executeWithoutParams("SELECT * FROM `permission` WHERE `DomainId` = '".$_GET['edit_domain']."'");
$rows = $statement->fetchAll(); $rows = $statement->fetchAll();
$domain_management_return_set['permissions'] = $rows; $domain_management_return_set['permissions'] = $rows;
//get all users //get all users
$pagination = new Pagination(WebUsers::getAllUsersQuery(),"web",10,"WebUsers"); $pagination = new Pagination(WebUsers::getAllUsersQuery(),"web",10,"WebUsers");
$domain_management_return_set['userlist'] = Gui_Elements::make_table($pagination->getElements() , Array("getUId","getUsername","getEmail"), Array("id","username","email")); $domain_management_return_set['userlist'] = Gui_Elements::make_table($pagination->getElements() , Array("getUId","getUsername","getEmail"), Array("id","username","email"));

View file

@ -6,7 +6,7 @@
<div class="box col-md-9"> <div class="box col-md-9">
<div class="box-inner"> <div class="box-inner">
<div class="box-header well" data-original-title=""> <div class="box-header well" data-original-title="">
<h2><i class="icon-list"></i> {$hook_info['Domain_Management']['domains'][$smarty.get.edit_domain-1]['domain_name']}</h2> <h2><i class="icon-list"></i> {$hook_info['Domain_Management']['domains']['0']['domain_name']}</h2>
</div> </div>
<div class="box-content"> <div class="box-content">
<div class="row-fluid"> <div class="row-fluid">
@ -21,11 +21,23 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{foreach from=$hook_info['Domain_Management']['userlist'] item=element} {assign var=val value=0}
{foreach from=$hook_info['Domain_Management']['userlist'] item=element name=loop}
<tr> <tr>
<td>{$element.id}</td> <td>{$element.id}</td>
<td class="center"><a href="index.php?page=show_user&id={$element.id}">{$element.username}</a></td> <td class="center"><a href="index.php?page=show_user&id={$element.id}">{$element.username}</a></td>
<td class="center">{$hook_info['Domain_Management']['permissions'][{$element.id}-1]['AccessPrivilege']}</td> <td class="center">
{if isset($hook_info['Domain_Management']['permissions'][{$val}]['UId']) and $smarty.foreach.loop.iteration eq $hook_info['Domain_Management']['permissions'][{$val}]['UId']}
{if $hook_info['Domain_Management']['permissions'][{$val}]['AccessPrivilege'] eq ''}
BANNED!
{else}
{$hook_info['Domain_Management']['permissions'][{$val}]['AccessPrivilege']}
{/if}
{assign var=val value=$val+1}
{else}
NO PERMISSIONS
{/if}
</td>
<td class="center"> <td class="center">
<div class="btn-group" style="display: inline-block;"> <div class="btn-group" style="display: inline-block;">
<a class="btn btn-info" href="index.php?page=settings&id={$element.id}"><i class=" icon-pencil icon-white"></i> Edit User Permissions</a> <a class="btn btn-info" href="index.php?page=settings&id={$element.id}"><i class=" icon-pencil icon-white"></i> Edit User Permissions</a>
@ -50,13 +62,13 @@
<form id="modifyMailSGroup" class="form-vertical" method="post" action="index.php?page=show_sgroup&id="> <form id="modifyMailSGroup" class="form-vertical" method="post" action="index.php?page=show_sgroup&id=">
<legend style="margin:0"> Domain Settings of '{$hook_info['Domain_Management']['domains'][$smarty.get.edit_domain-1]['domain_name']}'</legend> <legend style="margin:0"> Domain Settings of '{$hook_info['Domain_Management']['domains']['0']['domain_name']}'</legend>
<div class="control-group disabled" style="display: inline-block; "> <div class="control-group disabled" style="display: inline-block; ">
<label class="control-label">Domain ID</label> <label class="control-label">Domain ID</label>
<div class="controls"> <div class="controls">
<div class="input-prepend"> <div class="input-prepend">
<input type="text" id="domain_id" name="domain_id" value="{$hook_info['Domain_Management']['domains'][$smarty.get.edit_domain-1]['domain_id']}" disabled> <input type="text" id="domain_id" name="domain_id" value="{$hook_info['Domain_Management']['domains']['0']['domain_id']}" disabled>
</div> </div>
</div> </div>
</div> </div>
@ -65,7 +77,7 @@
<label class="control-label">Domain Name</label> <label class="control-label">Domain Name</label>
<div class="controls"> <div class="controls">
<div class="input-prepend"> <div class="input-prepend">
<input type="text" id="domain_name" name="domain_name" value="{$hook_info['Domain_Management']['domains'][$smarty.get.edit_domain-1]['domain_name']}"> <input type="text" id="domain_name" name="domain_name" value="{$hook_info['Domain_Management']['domains']['0']['domain_name']}">
</div> </div>
</div> </div>
</div> </div>
@ -74,10 +86,10 @@
<label class="control-label">Domain Status</label> <label class="control-label">Domain Status</label>
<div class="controls"> <div class="controls">
<select id="status" multiple class="form-control" data-rel="chosen"> <select id="status" multiple class="form-control" data-rel="chosen">
<option {if {$hook_info['Domain_Management']['domains'][$smarty.get.edit_domain-1]['status']} eq "ds_close"}selected{/if}>ds_close</option> <option {if {$hook_info['Domain_Management']['domains']['0']['status']} eq "ds_close"}selected{/if}>ds_close</option>
<option {if {$hook_info['Domain_Management']['domains'][$smarty.get.edit_domain-1]['status']} eq "ds_dev"}selected{/if}>ds_dev</option> <option {if {$hook_info['Domain_Management']['domains']['0']['status']} eq "ds_dev"}selected{/if}>ds_dev</option>
<option {if {$hook_info['Domain_Management']['domains'][$smarty.get.edit_domain-1]['status']} eq "ds_restricted"}selected{/if}>ds_restricted</option> <option {if {$hook_info['Domain_Management']['domains']['0']['status']} eq "ds_restricted"}selected{/if}>ds_restricted</option>
<option {if {$hook_info['Domain_Management']['domains'][$smarty.get.edit_domain-1]['status']} eq "ds_open"}selected{/if}>ds_open</option> <option {if {$hook_info['Domain_Management']['domains']['0']['status']} eq "ds_open"}selected{/if}>ds_open</option>
</select> </select>
</div> </div>
</div> </div>
@ -86,7 +98,7 @@
<label class="control-label">Patch Version</label> <label class="control-label">Patch Version</label>
<div class="controls"> <div class="controls">
<div class="input-prepend"> <div class="input-prepend">
<input type="text" id="patch_version" name="patch_version" value="{$hook_info['Domain_Management']['domains'][$smarty.get.edit_domain-1]['patch_version']}"> <input type="text" id="patch_version" name="patch_version" value="{$hook_info['Domain_Management']['domains']['0']['patch_version']}">
</div> </div>
</div> </div>
</div> </div>
@ -95,7 +107,7 @@
<label class="control-label">Backup Patch URL</label> <label class="control-label">Backup Patch URL</label>
<div class="controls"> <div class="controls">
<div class="input-prepend"> <div class="input-prepend">
<input type="text" id="backup_patch_url" name="backup_patch_url" value="{$hook_info['Domain_Management']['domains'][$smarty.get.edit_domain-1]['backup_patch_url']}"> <input type="text" id="backup_patch_url" name="backup_patch_url" value="{$hook_info['Domain_Management']['domains']['0']['backup_patch_url']}">
</div> </div>
</div> </div>
</div> </div>
@ -104,7 +116,7 @@
<label class="control-label">Patch URLs</label> <label class="control-label">Patch URLs</label>
<div class="controls"> <div class="controls">
<div class="input-prepend"> <div class="input-prepend">
<textarea id="patch_urls" name="patch_urls" >{$hook_info['Domain_Management']['domains'][$smarty.get.edit_domain-1]['patch_urls']}</textarea> <textarea id="patch_urls" name="patch_urls" >{$hook_info['Domain_Management']['domains']['0']['patch_urls']}</textarea>
</div> </div>
</div> </div>
</div> </div>
@ -113,7 +125,7 @@
<label class="control-label">Login Address</label> <label class="control-label">Login Address</label>
<div class="controls"> <div class="controls">
<div class="input-prepend"> <div class="input-prepend">
<input type="text" id="login_address" name="login_address" value="{$hook_info['Domain_Management']['domains'][$smarty.get.edit_domain-1]['login_address']}"> <input type="text" id="login_address" name="login_address" value="{$hook_info['Domain_Management']['domains']['0']['login_address']}">
</div> </div>
</div> </div>
</div> </div>
@ -122,7 +134,7 @@
<label class="control-label">Session Manager Address</label> <label class="control-label">Session Manager Address</label>
<div class="controls"> <div class="controls">
<div class="input-prepend"> <div class="input-prepend">
<input type="text" id="session_manager_address" name="session_manager_address" value="{$hook_info['Domain_Management']['domains'][$smarty.get.edit_domain-1]['session_manager_address']}"> <input type="text" id="session_manager_address" name="session_manager_address" value="{$hook_info['Domain_Management']['domains']['0']['session_manager_address']}">
</div> </div>
</div> </div>
</div> </div>
@ -131,7 +143,7 @@
<label class="control-label">Ring DB Name</label> <label class="control-label">Ring DB Name</label>
<div class="controls"> <div class="controls">
<div class="input-prepend"> <div class="input-prepend">
<input type="text" id="ring_db_name" name="ring_db_name" value="{$hook_info['Domain_Management']['domains'][$smarty.get.edit_domain-1]['ring_db_name']}"> <input type="text" id="ring_db_name" name="ring_db_name" value="{$hook_info['Domain_Management']['domains']['0']['ring_db_name']}">
</div> </div>
</div> </div>
</div> </div>
@ -140,7 +152,7 @@
<label class="control-label">Web Host</label> <label class="control-label">Web Host</label>
<div class="controls"> <div class="controls">
<div class="input-prepend"> <div class="input-prepend">
<input type="text" id="web_host" name="web_host" value="{$hook_info['Domain_Management']['domains'][$smarty.get.edit_domain-1]['web_host']}"> <input type="text" id="web_host" name="web_host" value="{$hook_info['Domain_Management']['domains']['0']['web_host']}">
</div> </div>
</div> </div>
</div> </div>
@ -149,7 +161,7 @@
<label class="control-label">Web Host PHP</label> <label class="control-label">Web Host PHP</label>
<div class="controls"> <div class="controls">
<div class="input-prepend"> <div class="input-prepend">
<input type="text" id="web_host_php" name="web_host_php" value="{$hook_info['Domain_Management']['domains'][$smarty.get.edit_domain-1]['web_host_php']}"> <input type="text" id="web_host_php" name="web_host_php" value="{$hook_info['Domain_Management']['domains']['0']['web_host_php']}">
</div> </div>
</div> </div>
</div> </div>
@ -158,7 +170,7 @@
<label class="control-label">Description</label> <label class="control-label">Description</label>
<div class="controls"> <div class="controls">
<div class="input-prepend"> <div class="input-prepend">
<textarea id="description" name="description" >{$hook_info['Domain_Management']['domains'][$smarty.get.edit_domain-1]['description']}</textarea> <textarea id="description" name="description" >{$hook_info['Domain_Management']['domains']['0']['description']}</textarea>
</div> </div>
</div> </div>
</div> </div>