本文整理匯總了PHP中Groups::verifyGroup方法的典型用法代碼示例。如果您正苦於以下問題:PHP Groups::verifyGroup方法的具體用法?PHP Groups::verifyGroup怎麽用?PHP Groups::verifyGroup使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Groups
的用法示例。
在下文中一共展示了Groups::verifyGroup方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: assignUserToGroup
/**
* assigns a user to a group
*
* @param string $userId
* @param string $groupId
* @return $result will return an object
*/
public function assignUserToGroup ($userId, $groupId)
{
try {
global $RBAC;
$RBAC->initRBAC();
$user = $RBAC->verifyUserId( $userId );
if ($user == 0) {
$result = new wsResponse( 3, G::loadTranslation( 'ID_USER_NOT_REGISTERED_SYSTEM' ) );
return $result;
}
$groups = new Groups();
$very_group = $groups->verifyGroup( $groupId );
if ($very_group == 0) {
$result = new wsResponse( 9, G::loadTranslation( 'ID_GROUP_NOT_REGISTERED_SYSTEM' ) );
return $result;
}
$very_user = $groups->verifyUsertoGroup( $groupId, $userId );
if ($very_user == 1) {
$result = new wsResponse( 8, G::loadTranslation( 'ID_USER_ALREADY_EXISTS_GROUP' ) );
return $result;
}
$groups->addUserToGroup( $groupId, $userId );
$result = new wsResponse( 0, G::loadTranslation( 'ID_COMMAND_EXECUTED_SUCCESSFULY' ) );
return $result;
} catch (Exception $e) {
$result = new wsResponse( 100, $e->getMessage() );
return $result;
}
}