本文整理汇总了PHP中RoleModel::getAllDefaultRoles方法的典型用法代码示例。如果您正苦于以下问题:PHP RoleModel::getAllDefaultRoles方法的具体用法?PHP RoleModel::getAllDefaultRoles怎么用?PHP RoleModel::getAllDefaultRoles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RoleModel
的用法示例。
在下文中一共展示了RoleModel::getAllDefaultRoles方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
// Try and find a system user.
$SystemUserID = Gdn::sql()->getWhere('User', array('Name' => 'System', 'Admin' => 2))->value('UserID');
if ($SystemUserID) {
saveToConfig('Garden.SystemUserID', $SystemUserID);
} else {
// Create a new one if we couldn't find one.
Gdn::userModel()->getSystemUserID();
}
}
// UserRole Table
$Construct->table('UserRole');
$UserRoleExists = $Construct->tableExists();
$Construct->column('UserID', 'int', false, 'primary')->column('RoleID', 'int', false, array('primary', 'index'))->set($Explicit, $Drop);
// Fix old default roles that were stored in the config and user-role table.
if ($RoleTableExists && $UserRoleExists && $RoleTypeExists) {
$types = $RoleModel->getAllDefaultRoles();
if ($v = c('Garden.Registration.ApplicantRoleID')) {
$SQL->update('Role')->set('Type', RoleModel::TYPE_APPLICANT)->where('RoleID', $types[RoleModel::TYPE_APPLICANT])->put();
// RemoveFromConfig('Garden.Registration.ApplicantRoleID');
}
if ($v = c('Garden.Registration.DefaultRoles')) {
$SQL->update('Role')->set('Type', RoleModel::TYPE_MEMBER)->where('RoleID', $types[RoleModel::TYPE_MEMBER])->put();
// RemoveFromConfig('Garden.Registration.DefaultRoles');
}
if ($v = c('Garden.Registration.ConfirmEmailRole')) {
$SQL->update('Role')->set('Type', RoleModel::TYPE_UNCONFIRMED)->where('RoleID', $types[RoleModel::TYPE_UNCONFIRMED])->put();
// RemoveFromConfig('Garden.Registration.ConfirmEmailRole');
}
$guestRoleIDs = Gdn::sql()->getWhere('UserRole', array('UserID' => 0))->resultArray();
if (!empty($guestRoleIDs)) {
$SQL->update('Role')->set('Type', RoleModel::TYPE_GUEST)->where('RoleID', $types[RoleModel::TYPE_GUEST])->put();