本文整理汇总了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');