/////////////////////////////////////////////////////////////// // // 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 ); } }
/////////////////////////////////////////////////////////////// // // CResource::FindAclRequest // // Will fail if right does not have a pending attribute // /////////////////////////////////////////////////////////////// bool CResource::FindAclRequest ( SAclRequest& result ) { if ( !FindAutoAcl () ) return false; CAccessControlListRight* pAclRight = GetAutoAcl ()->GetRight ( result.rightName.GetName (), result.rightName.GetType () ); if ( !pAclRight ) return false; // Fill SAclRequest result.bAccess = StringToBool ( pAclRight->GetAttributeValue ( "access" ) ); result.bPending = StringToBool ( pAclRight->GetAttributeValue ( "pending" ) ); result.strWho = pAclRight->GetAttributeValue ( "who" ); result.strDate = pAclRight->GetAttributeValue ( "date" ); // Ensure not pending and allow if ( result.bPending && result.bAccess ) { result.bAccess = false; CommitAclRequest ( result ); } return pAclRight->GetAttributeValue ( "pending" ) != ""; }