当前位置: 首页>>代码示例>>PHP>>正文


PHP TaskPermission::canDeleteUser方法代码示例

本文整理汇总了PHP中TaskPermission::canDeleteUser方法的典型用法代码示例。如果您正苦于以下问题:PHP TaskPermission::canDeleteUser方法的具体用法?PHP TaskPermission::canDeleteUser怎么用?PHP TaskPermission::canDeleteUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TaskPermission的用法示例。


在下文中一共展示了TaskPermission::canDeleteUser方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: function

				loginAsUser = function() {
					if (confirm('<?=$loginAsUserConfirm?>')) { 
						location.href = "<?=$this->url('/dashboard/users/search', 'sign_in_as_user', $uo->getUserID(), $valt->generate('sudo'))?>";				
					}
				}
				</script>

			<? } /*else { ?>
				<? print $ih->button_js(t('Sign In as User'), 'alert(\'' . t('You do not have permission to sign in as other users.') . '\')', 'left', 'ccm-button-inactive');?>
			<? }*/ ?>
		<? } ?>
		
		<?
		$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 (!$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'))?>";				
					}
				}
开发者ID:nveid,项目名称:concrete5,代码行数:31,代码来源:search.php

示例2: delete

	public function delete($delUserId, $token = null){
		$u=new User();
		try {

			$delUI=UserInfo::getByID($delUserId); 
			
			if(!($delUI instanceof UserInfo)) {
				throw new Exception(t('Invalid user ID.'));
			}

			if (!PermissionKey::getByHandle('access_user_search')->validate($delUI)) { 
				throw new Exception(t('Access Denied.'));
			}
		
			$tp = new TaskPermission();
			if (!$tp->canDeleteUser()) { 
				throw new Exception(t('You do not have permission to perform this action.'));
			}

			if ($delUserId == USER_SUPER_ID) {
				throw new Exception(t('You may not remove the super user account.'));
			}			

			if($delUserId==$u->getUserID()) {
				throw new Exception(t('You cannot delete your own user account.'));
			}


			$valt = Loader::helper('validation/token');
			if (!$valt->validate('delete_account', $token)) {
				throw new Exception($valt->getErrorMessage());
			}
			
			$delUI->delete(); 
			$resultMsg=t('User deleted successfully.');
			
			$_REQUEST=array();
			$_GET=array();
			$_POST=array();		
			$this->set('message', $resultMsg);
		} catch (Exception $e) {
			$this->set('error', $e);
		}
		$this->view();

	}
开发者ID:ronlobo,项目名称:concrete5,代码行数:46,代码来源:search.php

示例3: die

<?php

defined('C5_EXECUTE') or die("Access Denied.");
$searchInstance = Loader::helper('text')->entities($_REQUEST['searchInstance']);
if (!strlen($searchInstance)) {
    $searchInstance = 'user';
}
$form = Loader::helper('form');
$ih = Loader::helper('concrete/interface');
$tp = new TaskPermission();
$u = new User();
$sk = PermissionKey::getByHandle('access_user_search');
$tp = new TaskPermission();
if (!$tp->canDeleteUser()) {
    die(t("Access Denied."));
}
$users = array();
$excluded = false;
$excluded_user_ids = array();
$excluded_user_ids[] = $u->getUserID();
// can't delete yourself
$excluded_user_ids[] = USER_SUPER_ID;
// can't delete the super user (admin)
if (is_array($_REQUEST['uID'])) {
    foreach ($_REQUEST['uID'] as $uID) {
        $ui = UserInfo::getByID($uID);
        if (!$sk->validate($ui) || in_array($ui->getUserID(), $excluded_user_ids)) {
            $excluded = true;
        } else {
            $users[] = $ui;
        }
开发者ID:ricardomccerqueira,项目名称:rcerqueira.portfolio,代码行数:31,代码来源:bulk_delete.php


注:本文中的TaskPermission::canDeleteUser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。