コード例 #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;
}