Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'master' of github.com:concrete5/concrete5
  • Loading branch information
Ryan Tyler committed May 25, 2011
2 parents de933e2 + 9a50f8c commit 14a89aa
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 46 deletions.
7 changes: 4 additions & 3 deletions web/concrete/config/install/no_sample_content.sql
Expand Up @@ -350,7 +350,8 @@ INSERT INTO TaskPermissions VALUES(1,'access_task_permissions','Change Task Perm
,(6,'backup','Perform Full Database Backups','',0)
,(7,'sudo','Sign in as User','',0)
,(8,'uninstall_packages','Uninstall Packages','',0)
,(9,'install_packages','Install Packages and Connect to the Marketplace','',0);
,(9,'install_packages','Install Packages and Connect to the Marketplace','',0)
,(10,'delete_user','Delete Users','',0);

INSERT INTO TaskPermissionUserGroups VALUES(1,3,0,1)
,(2,3,0,1)
Expand All @@ -359,5 +360,5 @@ INSERT INTO TaskPermissionUserGroups VALUES(1,3,0,1)
,(5,3,0,1)
,(6,3,0,1)
,(8,3,0,1)
,(9,3,0,1);

,(9,3,0,1)
,(10,3,0,1);
6 changes: 4 additions & 2 deletions web/concrete/config/install/sample_content.sql
Expand Up @@ -921,7 +921,8 @@ INSERT INTO TaskPermissions VALUES(1,'access_task_permissions','Change Task Perm
,(6,'backup','Perform Full Database Backups','',0)
,(7,'sudo','Sign in as User','',0)
,(8,'uninstall_packages','Uninstall Packages','',0)
,(9,'install_packages','Install Packages and Connect to the Marketplace','',0);
,(9,'install_packages','Install Packages and Connect to the Marketplace','',0)
,(10,'delete_user','Delete Users','',0);

INSERT INTO TaskPermissionUserGroups VALUES(1,3,0,1)
,(2,3,0,1)
Expand All @@ -930,7 +931,8 @@ INSERT INTO TaskPermissionUserGroups VALUES(1,3,0,1)
,(5,3,0,1)
,(6,3,0,1)
,(8,3,0,1)
,(9,3,0,1);
,(9,3,0,1)
,(10,3,0,1);

INSERT INTO atBoolean VALUES(14,0)
,(18,1)
Expand Down
5 changes: 3 additions & 2 deletions web/concrete/controllers/dashboard/users/search.php
Expand Up @@ -138,8 +138,9 @@ public function edit_attribute() {
public function delete($delUserId, $token = null){
$u=new User();
try {

if(!$u->isSuperUser()) {

$tp = new TaskPermission();
if (!$tp->canDeleteUser()) {
throw new Exception(t('You do not have permission to perform this action.'));
}

Expand Down
4 changes: 2 additions & 2 deletions web/concrete/controllers/login.php
Expand Up @@ -244,8 +244,8 @@ protected function finishLogin( $loginData=array() ) {
$this->set('invalidRegistrationFields', true);
$this->set('unfilledAttributes', $unfilledAttributes);
}

$rcID = $this->post('rcID');
$txt = Loader::helper('text');
$rcID = $txt->entities($this->post('rcID'));
$nh = Loader::helper('validation/numbers');

//set redirect url
Expand Down
18 changes: 1 addition & 17 deletions web/concrete/css/ccm.menus.css
@@ -1,21 +1,5 @@
/*
div.ccm-menu-l {background: transparent url(../images/bg_menu_l.png) repeat-y scroll 0 0; width:100%; height:auto; }
div.ccm-menu-r {background: transparent url(../images/bg_menu_r.png) repeat-y scroll 100% 0; }
div.ccm-menu-b {background: transparent url(../images/bg_menu_b.png) repeat-x 0 100%; height: 31px; margin-left: 26px; margin-right: 26px; width:128px;}
div.ccm-menu-bl { background: transparent url(../images/bg_menu_lb.png) no-repeat 0 100%; clear:both }
div.ccm-menu-br {background: transparent url(../images/bg_menu_rb.png) no-repeat 100% 100%;}
div.ccm-menu-t {background: transparent url(../images/bg_menu_t.png) repeat-x 0 0; height: 21px; margin-left: 26px; margin-right: 26px; width:128px;}
div.ccm-menu-tl {background: transparent url(../images/bg_menu_lt.png) no-repeat 0 0; }
div.ccm-menu-tr {background: transparent url(../images/bg_menu_rt.png) no-repeat 100% 0;}
*/


div.ccm-menu {
z-index: 500;
z-index: 9999;
font-family: "Lucida Grande", Arial, Helvetica;
-khtml-user-select: none;
-moz-user-select: none;
Expand Down
12 changes: 12 additions & 0 deletions web/concrete/helpers/concrete/upgrade/version_542.php
Expand Up @@ -20,6 +20,18 @@
defined('C5_EXECUTE') or die("Access Denied.");
class ConcreteUpgradeVersion542Helper {

public function run() {
$db = Loader::db();
$cnt = $db->GetOne('select count(*) from TaskPermissions where tpHandle = ?', array('delete_user'));
if ($cnt < 1) {
$g3 = Group::getByID(ADMIN_GROUP_ID);
$tip = TaskPermission::addTask('delete_user', t('Delete Users'), false);
if (is_object($g3)) {
$tip->addAccess($g3);
}
}
}

public function prepare() {
// we install the updated schema just for tables that matter
Package::installDB(dirname(__FILE__) . '/db/version_542.xml');
Expand Down
4 changes: 4 additions & 0 deletions web/concrete/libraries/view.php
Expand Up @@ -604,6 +604,10 @@ public function render($view, $args = null) {
$this->controller = Loader::controller($view);
$this->controller->setupAndRun();
}

if ($this->controller->getRenderOverride() != '') {
$view = $this->controller->getRenderOverride();
}

// Determine which inner item to load, load it, and stick it in $innerContent
$content = false;
Expand Down
3 changes: 2 additions & 1 deletion web/concrete/single_pages/dashboard/settings/view.php
Expand Up @@ -24,7 +24,8 @@
TaskPermission::getByHandle('install_packages'),
TaskPermission::getByHandle('uninstall_packages'),
TaskPermission::getByHandle('backup'),
TaskPermission::getByHandle('sudo')
TaskPermission::getByHandle('sudo'),
TaskPermission::getByHandle('delete_user')
);
$tpl = new TaskPermissionList();
foreach($tps as $tp) {
Expand Down
43 changes: 24 additions & 19 deletions web/concrete/single_pages/dashboard/users/search.php
Expand Up @@ -504,33 +504,38 @@ function editAttrVal(attId,cancel){
</table>
</div>
</div>



<h1><span><?=t('Delete User')?></span></h1>

<div class="ccm-dashboard-inner">
<div class="ccm-spacer"></div>
<?
$cu = new User();
$tp = new TaskPermission();
if ($tp->canDeleteUser()) {
$delConfirmJS = t('Are you sure you want to permanently remove this user?');
if ($uo->getUserID() == USER_SUPER_ID) { ?>
<?=t('You may not remove the super user account.')?>
<? } else if($u->isSuperUser() == false){ ?>
<?=t('You must be logged in as %s to remove user accounts.', USER_SUPER)?>

<? }else{ ?>

<script type="text/javascript">
deleteUser = function() {
if (confirm('<?=$delConfirmJS?>')) {
location.href = "<?=$this->url('/dashboard/users/search', 'delete', $uo->getUserID(), $valt->generate('delete_account'))?>";
if ($uo->getUserID() == USER_SUPER_ID) { ?>
<?=t('You may not remove the super user account.')?>
<? } else if (!$tp->canDeleteUser()) { ?>
<?=t('You do not have permission to perform this action.');
} else if ($uo->getUserID() == $cu->getUserID()) {
echo t('You cannot delete your own user account.');
}else{ ?>

<script type="text/javascript">
deleteUser = function() {
if (confirm('<?=$delConfirmJS?>')) {
location.href = "<?=$this->url('/dashboard/users/search', 'delete', $uo->getUserID(), $valt->generate('delete_account'))?>";
}
}
}
</script>

<? print $ih->button_js(t('Delete User Account'), "deleteUser()", 'left');?>

<? } ?>
</script>

<? print $ih->button_js(t('Delete User Account'), "deleteUser()", 'left');?>

<? }
} else {
echo t('You do not have permission to perform this action.');
}?>
<div class="ccm-spacer"></div>
</div>
<? } ?>
Expand Down

0 comments on commit 14a89aa

Please sign in to comment.