ios: don't report read access to assets if unauthorized access

Don't report read access to assets if we know that we are unauthorized
to load them. Note that if authorization is ALAuthorizationStatusNotDetermined
we continue to report read access, since we don't really know the permissions
until we try to load.

Change-Id: If51cfe9f5c57f8f33f463bddf81a77fade5fb89d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
bb10
Richard Moe Gustavsen 2015-04-24 12:34:36 +02:00
parent 9166e7a50a
commit 7bc241c8d3
1 changed files with 5 additions and 2 deletions

View File

@ -174,8 +174,11 @@ QAbstractFileEngine::FileFlags QIOSFileEngineAssetsLibrary::fileFlags(QAbstractF
if (type & FlagsMask)
flags |= ExistsFlag;
if (type & PermsMask)
flags |= ReadOwnerPerm | ReadUserPerm | ReadGroupPerm | ReadOtherPerm;
if (type & PermsMask) {
ALAuthorizationStatus status = [ALAssetsLibrary authorizationStatus];
if (status != ALAuthorizationStatusRestricted && status != ALAuthorizationStatusDenied)
flags |= ReadOwnerPerm | ReadUserPerm | ReadGroupPerm | ReadOtherPerm;
}
if (type & TypesMask)
flags |= FileType;