コード例 #1
0
CAccessControlListRight* CAccessControlList::GetRight ( const char* szRightName, CAccessControlListRight::ERightType eRightType )
{
    unsigned int uiHash = HashString ( szRightName );

    list < CAccessControlListRight* > ::iterator iter = m_Rights.begin ();
    for ( ; iter != m_Rights.end (); iter++ )
    {
        CAccessControlListRight* pACLRight = *iter;
        if ( eRightType == pACLRight->GetRightType () )
        {
            if ( pACLRight->GetRightNameHash () == uiHash && SStringX ( szRightName ) == pACLRight->GetRightName () )
            {
                // Exact match
                return pACLRight;
            }
        }
    }
    return NULL;
}
コード例 #2
0
bool CAccessControlList::RemoveRight ( const char* szRightName, CAccessControlListRight::ERightType eRightType )
{
    unsigned int uiHash = HashString ( szRightName );

    list < CAccessControlListRight* > ::iterator iter = m_Rights.begin ();
    for ( ; iter != m_Rights.end (); iter++ )
    {
        CAccessControlListRight* pACLRight = *iter;
        if ( pACLRight->GetRightNameHash () == uiHash && eRightType == pACLRight->GetRightType ()
             && SStringX ( szRightName ) == pACLRight->GetRightName () )
        {
            m_Rights.remove ( pACLRight );
            delete pACLRight;
            OnChange ();
            return true;
        }
    }

    return false;
}
コード例 #3
0
///////////////////////////////////////////////////////////////
//
// CResource::GetAclRequests
//
// Get all acl requests for this resource
//
///////////////////////////////////////////////////////////////
void CResource::GetAclRequests ( std::vector < SAclRequest >& outResultList )
{
    outResultList.clear ();

    CAccessControlList* pAutoAcl = FindAutoAcl ();
    if ( !pAutoAcl )
        return;

    // Get each right
    for ( std::list < CAccessControlListRight* >::const_iterator iter = pAutoAcl->IterBegin () ; iter != pAutoAcl->IterEnd () ; ++iter )
    {
        CAccessControlListRight* pAclRight = *iter;

        // Create SAclRequest from ACL
        SAclRequest request ( CAclRightName ( pAclRight->GetRightType (), pAclRight->GetRightName () ) );
        request.bAccess = StringToBool ( pAclRight->GetAttributeValue ( "access" ) );
        request.bPending = StringToBool ( pAclRight->GetAttributeValue ( "pending" ) );
        request.strWho = pAclRight->GetAttributeValue ( "who" );
        request.strDate = pAclRight->GetAttributeValue ( "date" );

        outResultList.push_back ( request );
    }
}