本文整理匯總了PHP中role::delete_role方法的典型用法代碼示例。如果您正苦於以下問題:PHP role::delete_role方法的具體用法?PHP role::delete_role怎麽用?PHP role::delete_role使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類role
的用法示例。
在下文中一共展示了role::delete_role方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: array
{
DB::table(PREFIX . 'codo_roles')->where('rid', '=', $id)->delete();
DB::table(PREFIX . 'codo_user_roles')->where('rid', '=', $id)->delete();
DB::table(PREFIX . 'codo_permissions')->where('rid', '=', $id)->delete();
DB::table(PREFIX . 'codo_block_roles')->where('rid', '=', $id)->delete();
}
}
//NEW
if (isset($_POST['role_name']) && CODOF\Access\CSRF::valid($_POST['CSRF_token'])) {
$manager = new CODOF\Permission\Manager();
$rid = $manager->addRole($_POST['role_name']);
$fromRid = $_POST['copy_from_role_id'];
$manager->copyRole($fromRid, $rid);
$smarty->assign('msg', "Role added successfully.");
}
$smarty->assign('msgType', 'info');
//Delete
if (isset($_POST['del_role_id']) && CODOF\Access\CSRF::valid($_POST['CSRF_token'])) {
$rid = (int) $_POST['del_role_id'];
$systemRoles = array(ROLE_ADMIN, ROLE_BANNED, ROLE_GUEST, ROLE_MODERATOR, ROLE_UNVERIFIED, ROLE_USER);
if (!in_array($rid, $systemRoles)) {
role::delete_role($_POST['del_role_id']);
$smarty->assign('msg', "Role deleted successfully.");
} else {
$smarty->assign('msg', "System defined roles cannot be deleted.");
$smarty->assign('msgType', 'danger');
}
}
$roles = DB::table(PREFIX . 'codo_roles')->get();
$smarty->assign('roles', $roles);
$content = $smarty->fetch('permission/roles.tpl');