本文整理汇总了C++中AccountHandler::hasAccess方法的典型用法代码示例。如果您正苦于以下问题:C++ AccountHandler::hasAccess方法的具体用法?C++ AccountHandler::hasAccess怎么用?C++ AccountHandler::hasAccess使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AccountHandler
的用法示例。
在下文中一共展示了AccountHandler::hasAccess方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addCollaborator
void AbiCollab::addCollaborator(BuddyPtr pCollaborator)
{
UT_DEBUGMSG(("AbiCollab::addCollaborator()\n"));
UT_return_if_fail(pCollaborator)
// check if this buddy is in the access control list if we are hosting
// this session
if (isLocallyControlled())
{
AccountHandler* pAccount = pCollaborator->getHandler();
UT_return_if_fail(pAccount);
if (!pAccount->hasAccess(m_vAcl, pCollaborator))
{
UT_ASSERT(UT_NOT_IMPLEMENTED);
return;
}
}
// check for duplicates (as long as we assume a collaborator can only be part of a collaboration session once)
std::map<BuddyPtr, std::string>::iterator it = m_vCollaborators.find(pCollaborator);
if (it != m_vCollaborators.end())
{
UT_DEBUGMSG(("Attempting to add buddy '%s' twice to a collaboration session!", pCollaborator->getDescription().utf8_str()));
UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN);
return;
}
m_vCollaborators[pCollaborator] = ""; // will fill the remote document UUID later once we receive a packet from this buddy
}
示例2: updateAcl
// should we move this to AbiCollab.cpp ?
void AbiCollabSessionManager::updateAcl(AbiCollab* pSession, AccountHandler* pAccount, const std::vector<std::string> vAcl)
{
UT_return_if_fail(pSession);
UT_return_if_fail(pAccount);
// check if all current collaborators are still allowed to collaborate; if not,
// then remove them from the session
const std::map<BuddyPtr, std::string> collaborators = pSession->getCollaborators();
for (std::map<BuddyPtr, std::string>::const_iterator cit = collaborators.begin(); cit != collaborators.end(); cit++)
{
BuddyPtr pBuddy = (*cit).first;
UT_continue_if_fail(pBuddy);
AccountHandler* pBuddyAccount = pBuddy->getHandler();
UT_continue_if_fail(pBuddyAccount);
UT_continue_if_fail(pBuddyAccount == pAccount);
if (!pBuddyAccount->hasAccess(vAcl, pBuddy))
{
// this current collaborator has been banned from the session, so
// disconnect him
UT_ASSERT_HARMLESS(UT_NOT_IMPLEMENTED);
}
}
// set the new ACL on the account handler
pAccount->setAcl(pSession, vAcl);
// set the new access control list on the session
pSession->setAcl(vAcl);
}