本文整理匯總了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'));
}