本文整理汇总了PHP中OA_Permission::isUsernameAllowed方法的典型用法代码示例。如果您正苦于以下问题:PHP OA_Permission::isUsernameAllowed方法的具体用法?PHP OA_Permission::isUsernameAllowed怎么用?PHP OA_Permission::isUsernameAllowed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OA_Permission
的用法示例。
在下文中一共展示了OA_Permission::isUsernameAllowed方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _validateUsername
/**
* This method performs data validation for the username uniqueness
*
* @param OA_Dll_UserInfo $oUser
* @param OA_Dll_UserInfo $oOldUser
* @return boolean
*/
function _validateUsername(&$oUser, $oOldUser = null)
{
if (isset($oUser->username)) {
$oldUsername = empty($oOldUser) ? '' : $oOldUser->username;
if (!OA_Permission::isUsernameAllowed($oUser->username, $oldUsername)) {
$this->raiseError(self::ERROR_USERNAME_NOT_UNIQUE);
return false;
}
}
return true;
}
示例2: _validateUsername
/**
* This method performs data validation for the username uniqueness
*
* @param OA_Dll_UserInfo $oUser
* @param OA_Dll_UserInfo $oOldUser
* @return boolean
*/
function _validateUsername(&$oUser, $oOldUser = null)
{
if (isset($oUser->username)) {
$oldUsername = empty($oOldUser) ? '' : $oOldUser->username;
if (!OA_Permission::isUsernameAllowed($oUser->username, $oldUsername)) {
$this->raiseError('Username must be unique');
return false;
}
}
return true;
}
示例3: testIsUsernameAllowed
function testIsUsernameAllowed()
{
// If the names are the same then true
$this->assertTrue(OA_Permission::isUsernameAllowed('foo', 'foo'));
// Check users as client, affiliate, agency
$doClients = OA_Dal::factoryDO('clients');
$doClients->reportlastdate = '2007-04-02 12:00:00';
$clientId = DataGenerator::generateOne($doClients);
$username = 'username1' . rand(1, 1000);
$aUser = array('contact_name' => 'contact', 'email_address' => 'email@example.com', 'username' => $username, 'password' => 'password');
$doClient = OA_Dal::staticGetDO('clients', $clientId);
$doClient->createUser($aUser);
$this->assertFalse(OA_Permission::isUsernameAllowed($username, 'foo'));
$this->assertTrue(OA_Permission::isUsernameAllowed('newname', 'foo'));
}