本文整理汇总了PHP中Permission::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Permission::delete方法的具体用法?PHP Permission::delete怎么用?PHP Permission::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Permission
的用法示例。
在下文中一共展示了Permission::delete方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: disable
function disable()
{
$permission = new Permission();
$cc = new ConstraintChain();
$cc->add(new Constraint('permission', '=', $this->name));
$permission->loadBy($cc);
if ($permission && $permission->delete()) {
return $this->update($this->id, 'enabled', false);
}
return true;
}
示例2: procede
public function procede()
{
try {
if ($this->oRequest->existParam('m')) {
if (!$this->oRequest->existParam('r')) {
throw new Error('FRAMEWORK_ERROR_ACCESS_UNKNOWN', 3);
}
$oPermission = new Permission($this->oRequest->getParam('m', 'int'), $this->oRequest->getParam('r', 'int'));
if ($this->oRequest->getParam('v', 'boolean')) {
$oPermission->store();
} else {
$oPermission->delete();
}
Logger::log('admin', Language::translate('PERMISSIONS_ADMIN_ACCESS_UPDATELOG') . '[' . $this->oCurrentUser->getLogin() . ']');
$this->oView->addAlert(Language::translate('PERMISSIONS_ADMIN_ACCESS_UPDATE'), 'success');
}
} catch (Exception $ex) {
$this->oView->addAlert($ex, 'danger');
} finally {
$this->createView();
}
}
示例3: remove_permission
/**
* Remove Permission
* Remove a permission from the database
*
* @param mixed $permission
*/
public function remove_permission($permission)
{
$p = new Permission();
$p->get_by_permission($permission);
if (!$p->exists()) {
$p->delete();
}
}
示例4: delete
public function delete()
{
// we're echoing JSON, so lets tell the browser
// this is required for $.ajax to be able to intelligently guess what the dataType is
header('Content-type: application/json');
// get the id from data
if (is_ajax()) {
$id = !empty($this->_data['id']) ? $this->_data['id'] : $_id;
}
$permission = new Permission();
// NOTE: the db will take care od cascading the delete to child rows
if ($permission->delete($id)) {
echo json_encode(array('success' => TRUE));
} else {
echo json_encode(array('success' => FALSE));
}
exit;
}
示例5: session_start
<?php
session_start();
include_once "../php/Permission.php";
if (isset($_POST['save'])) {
$permission = new Permission();
$permission->lockSerial($_POST['lock']);
$permission->recipientIdentification($_POST['recipient']);
$permission->startDateHour($_POST['startDateHour']);
$permission->endDateHour($_POST['endDateHour']);
echo "tt";
$permission->insert();
} elseif (isset($_POST['update'])) {
$permission = new Permission();
$permission->lockSerial($_POST['lock']);
$permission->recipientIdentification($_POST['recipient']);
$permission->startDateHour($_POST['startDateHour']);
$permission->endDateHour($_POST['endDateHour']);
$permission->update();
} elseif (isset($_POST['delete'])) {
Permission::delete($_POST['lock'], $_POST['recipient']);
}
header("location: showPermissions.php");
示例6: managePermission
public function managePermission($action)
{
try {
$user_name = fRequest::get('user_name');
$permission_name = fRequest::get('permission_name');
if ($action == 'Add') {
if (User::can('add-permission')) {
$permission = new Permission();
$permission->setUserName($user_name);
$permission->setPermissionName($permission_name);
$permission->store();
fMessaging::create('success', 'Permission added successfully.');
} else {
throw new fAuthorizationException('You are not allowed to add permissions.');
}
} else {
if ($action == 'Remove') {
if (User::can('remove-permission')) {
$permission = new Permission(array('user_name' => $user_name, 'permission_name' => $permission_name));
$permission->delete();
fMessaging::create('success', 'Permission removed successfully.');
} else {
throw new fAuthorizationException('You are not allowed to remove permissions.');
}
}
}
} catch (fException $e) {
fMessaging::create('error', $e->getMessage());
}
fURL::redirect(Util::getReferer());
}