Qt for HarmonyOS/qtohosextras doc/FileShare Namespace: Difference between revisions
No edit summary |
Drop manual breadcrumb, MediaWiki renders it automatically (QTFOROH-2307) |
||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
= FileShare Namespace = | |||
QtOhosExtras::FileShare | |||
The FileShare to expose file permission API. [[#details|More...]] | The FileShare to expose file permission API. [[#details|More...]] | ||
| Line 7: | Line 7: | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
| Header: | |||
| #include <FileShare> | | #include <FileShare> | ||
|- | |- | ||
| qmake: | |||
| QT += ohosextras | | QT += ohosextras | ||
|- | |- | ||
| Since: | |||
| Qt 5.12.12 | | Qt 5.12.12 | ||
|} | |} | ||
This namespace was introduced in Qt 5.12.12. | |||
== Classes == | == Classes == | ||
{| class="wikitable | {| class="wikitable" | ||
|- | |- | ||
| class | | class | ||
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/ActionResult_Class|ActionResult]]''' | |||
|- | |- | ||
| class | | class | ||
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/CheckResult_Class|CheckResult]]''' | |||
|- | |- | ||
| | | struct | ||
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/PathPolicy_Class|PathPolicy]]''' | |||
|- | |- | ||
| | | struct | ||
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/PathPolicyCheckResult_Class|PathPolicyCheckResult]]''' | |||
|- | |- | ||
| | | struct | ||
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/PathPolicyErrorInfo_Class|PathPolicyErrorInfo]]''' | |||
|} | |} | ||
== Types == | == Types == | ||
{| class="wikitable | {| class="wikitable" | ||
|- | |- | ||
| enum | | enum class | ||
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#OperationMode-enum|OperationMode]]''' { Read, Write } | |||
|- | |- | ||
| flags | | flags | ||
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#OperationMode-enum|OperationModes]]''' | |||
|- | |- | ||
| enum | | enum class | ||
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#PathPolicyError-enum|PathPolicyError]]''' { Unknown, PersistenceForbidden, InvalidMode, InvalidPath, PermissionNotPersisted } | |||
|} | |} | ||
== Functions == | == Functions == | ||
{| class="wikitable | {| class="wikitable" | ||
|- | |- | ||
| QSharedPointer< | | QSharedPointer<ActionResult> | ||
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#activatePermission|activatePermission]]'''(const QList<PathPolicy> &''policies'') | |||
|- | |- | ||
| QSharedPointer< | | QSharedPointer<CheckResult> | ||
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#checkPersistent|checkPersistent]]'''(const QList<PathPolicy> &''policies'') | |||
|- | |- | ||
| QSharedPointer< | | QSharedPointer<ActionResult> | ||
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#deactivatePermission|deactivatePermission]]'''(const QList<PathPolicy> &''policies'') | |||
|- | |- | ||
| QSharedPointer< | | QSharedPointer<ActionResult> | ||
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#persistPermission|persistPermission]]'''(const QList<PathPolicy> &''policies'') | |||
|- | |- | ||
| QSharedPointer<ActionResult> | |||
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#revokePermission|revokePermission]]'''(const QList<PathPolicy> &''policies'') | |||
| QSharedPointer< | |||
|} | |} | ||
== Detailed Description == | == Detailed Description == | ||
This API uses file system paths, which differ from the URIs used internally by HarmonyOS. For example, the path <code>/data/storage/el1/bundle/entry/resources/resfile/test.txt</code> will be converted to the URI <code>file://com.your.example/data/storage/el1/bundle/entry/resources/resfile/test.txt</code> , where <code>com.your.example</code> is app bundle name. | This API uses file system paths, which differ from the URIs used internally by HarmonyOS. For example, the path <code>/data/storage/el1/bundle/entry/resources/resfile/test.txt</code> will be converted to the URI <code>file://com.your.example/data/storage/el1/bundle/entry/resources/resfile/test.txt</code> , where <code>com.your.example</code> is app bundle name. | ||
| Line 77: | Line 79: | ||
To learn more about file paths and URIs in HarmonyOS, see [https://developer.huawei.com/consumer/en/doc/harmonyos-guides-V5/app-sandbox-directory-V5 sandbox documentation]. | To learn more about file paths and URIs in HarmonyOS, see [https://developer.huawei.com/consumer/en/doc/harmonyos-guides-V5/app-sandbox-directory-V5 sandbox documentation]. | ||
'''Warning:''' This API relies on the underlying OHOS implementation. The following functions: [[#persistPermission|persistPermission() | '''Warning: '''This API relies on the underlying OHOS implementation. The following functions: [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#persistPermission|persistPermission]](), [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#revokePermission|revokePermission]](), [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#activatePermission|activatePermission]](), [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#deactivatePermission|deactivatePermission]](), and [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#checkPersistent|checkPersistent]]() may be unavailable on some devices. Additionally, there may be limitations on the maximum number of policies, and certain permissions may need to be explicitly granted to the application. | ||
For more details and limitations, refer to the [https://developer.huawei.com/consumer/en/doc/harmonyos-guides-V14/native-fileshare-guidelines-V14 API documentation]. | For more details and limitations, refer to the [https://developer.huawei.com/consumer/en/doc/harmonyos-guides-V14/native-fileshare-guidelines-V14 API documentation]. | ||
== Classes == | |||
=== class [[Qt_for_HarmonyOS/qtohosextras_doc/ActionResult_Class|ActionResult]] === | |||
The ActionResult class encapsulates the result of all file requested access permission actions. [[Qt_for_HarmonyOS/qtohosextras_doc/ActionResult_Class#details|More...]] | |||
=== class [[Qt_for_HarmonyOS/qtohosextras_doc/CheckResult_Class|CheckResult]] === | |||
The CheckResult class encapsulates the result of all requested file access permission checks. [[Qt_for_HarmonyOS/qtohosextras_doc/CheckResult_Class#details|More...]] | |||
=== class [[Qt_for_HarmonyOS/qtohosextras_doc/PathPolicy_Class|PathPolicy]] === | |||
The PathPolicy struct encapsulates information required to request file access permissions for a specified path. [[Qt_for_HarmonyOS/qtohosextras_doc/PathPolicy_Class#details|More...]] | |||
=== class [[Qt_for_HarmonyOS/qtohosextras_doc/PathPolicyCheckResult_Class|PathPolicyCheckResult]] === | |||
The PathPolicyCheckResult struct contains the result of a file permission check request for a specified path, indicating whether access is granted or denied. [[Qt_for_HarmonyOS/qtohosextras_doc/PathPolicyCheckResult_Class#details|More...]] | |||
=== class [[Qt_for_HarmonyOS/qtohosextras_doc/PathPolicyErrorInfo_Class|PathPolicyErrorInfo]] === | |||
The PathPolicyErrorInfo struct contains the result of a file access permission request for a specified path. [[Qt_for_HarmonyOS/qtohosextras_doc/PathPolicyErrorInfo_Class#details|More...]] | |||
== Type Documentation == | == Type Documentation == | ||
=== <span id="OperationMode-enum"></span>enum FileShare::OperationMode | === <span id="OperationMode-enum"></span>enum class FileShare::OperationMode<br/>flags FileShare::OperationModes === | ||
Defines permissions on path. See [https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/file_share-V5#fileshare_operationmode FileShare_OperationMode]. The flags can be combined using bitwise operations. | Defines permissions on path. See [https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/file_share-V5#fileshare_operationmode FileShare_OperationMode]. The flags can be combined using bitwise operations. | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
! Constant | |||
! Value | |||
! Description | |||
|- | |- | ||
| <code>QtOhosExtras::FileShare::Write</code> | | <code>QtOhosExtras::FileShare::OperationMode::Read</code> | ||
| <code>1 << 0</code> | |||
| Read on path | |||
|- | |||
| <code>QtOhosExtras::FileShare::OperationMode::Write</code> | |||
| <code>1 << 1</code> | |||
| Write on path | |||
|} | |} | ||
This enum was introduced or modified in Qt 5.12.12. | This enum was introduced or modified in Qt 5.12.12. | ||
The OperationModes type is a typedef for QFlags<OperationMode>. It stores an OR combination of OperationMode values. | The OperationModes type is a typedef for [https://doc.qt.io/qt-5/qflags.html QFlags]<OperationMode>. It stores an OR combination of OperationMode values. | ||
'''See also | '''See also '''[[Qt_for_HarmonyOS/qtohosextras_doc/PathPolicy_Class|PathPolicy]]. | ||
=== <span id="PathPolicyError-enum"></span>enum FileShare::PathPolicyError === | === <span id="PathPolicyError-enum"></span>enum class FileShare::PathPolicyError === | ||
Defines permission policy error codes. See [https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/file_share-V5#fileshare_policyerrorcode FileShare_PolicyErrorCode]. | Defines permission policy error codes. See [https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/file_share-V5#fileshare_policyerrorcode FileShare_PolicyErrorCode]. | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
| <code>QtOhosExtras::FileShare::Unknown</code> | | ! Constant | ||
! Value | |||
! Description | |||
|- | |||
| <code>QtOhosExtras::FileShare::PathPolicyError::Unknown</code> | |||
| <code>0</code> | |||
| Error type is unknown or not recognized | |||
|- | |- | ||
| <code>QtOhosExtras::FileShare::PersistenceForbidden</code> | | | <code>QtOhosExtras::FileShare::PathPolicyError::PersistenceForbidden</code> | ||
| <code>1</code> | |||
| The permission on the path cannot be persisted | |||
|- | |- | ||
| <code>QtOhosExtras::FileShare::InvalidMode</code> | | | <code>QtOhosExtras::FileShare::PathPolicyError::InvalidMode</code> | ||
| <code>2</code> | |||
| Invalid operation mode | |||
|- | |- | ||
| <code>QtOhosExtras::FileShare::InvalidPath</code> | | | <code>QtOhosExtras::FileShare::PathPolicyError::InvalidPath</code> | ||
| <code>3</code> | |||
| Invalid path | |||
|- | |- | ||
| <code>QtOhosExtras::FileShare::PermissionNotPersisted</code> | | | <code>QtOhosExtras::FileShare::PathPolicyError::PermissionNotPersisted</code> | ||
| <code>4</code> | |||
| The permission is not persisted | |||
|} | |} | ||
This enum was introduced or modified in Qt 5.12.12. | This enum was introduced or modified in Qt 5.12.12. | ||
'''See also | '''See also '''[[Qt_for_HarmonyOS/qtohosextras_doc/PathPolicyErrorInfo_Class|PathPolicyErrorInfo]]. | ||
== Function Documentation == | == Function Documentation == | ||
=== <span id="activatePermission"></span>QSharedPointer<ActionResult> FileShare::activatePermission(const QList<PathPolicy> &''policies'') === | === <span id="activatePermission"></span>[https://doc.qt.io/qt-5/qsharedpointer.html QSharedPointer]<[[Qt_for_HarmonyOS/qtohosextras_doc/ActionResult_Class|ActionResult]]> FileShare::activatePermission(const [https://doc.qt.io/qt-5/qlist.html QList]<[[Qt_for_HarmonyOS/qtohosextras_doc/PathPolicy_Class|PathPolicy]]> &''policies'') === | ||
Activates file or folder permissions from ''policies''. The success of the action can be determined from [[ActionResult_Class|ActionResult]]. | Activates file or folder permissions from ''policies''. The success of the action can be determined from [[Qt_for_HarmonyOS/qtohosextras_doc/ActionResult_Class|ActionResult]]. | ||
This function calls [https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/file_share-V5#oh_fileshare_activatepermission OH_FileShare_ActivatePermission]. Each time an application is started, its persistent permissions have not been loaded to the memory. Use this function to make a persistent permission active after the application is started. If the activation fails because the permission has not been persisted, use [[#persistPermission|persistPermission() | This function calls [https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/file_share-V5#oh_fileshare_activatepermission OH_FileShare_ActivatePermission]. Each time an application is started, its persistent permissions have not been loaded to the memory. Use this function to make a persistent permission active after the application is started. If the activation fails because the permission has not been persisted, use [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#persistPermission|persistPermission]]() first. | ||
To deactivate an active permission, use [[#deactivatePermission|deactivatePermission() | To deactivate an active permission, use [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#deactivatePermission|deactivatePermission]](). | ||
'''See also | '''See also '''[[Qt_for_HarmonyOS/qtohosextras_doc/ActionResult_Class|ActionResult]], [[Qt_for_HarmonyOS/qtohosextras_doc/PathPolicy_Class|PathPolicy]], [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#persistPermission|persistPermission]](), and [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#deactivatePermission|deactivatePermission]](). | ||
=== <span id="checkPersistent"></span>QSharedPointer<CheckResult> FileShare::checkPersistent(const QList<PathPolicy> &''policies'') === | === <span id="checkPersistent"></span>[https://doc.qt.io/qt-5/qsharedpointer.html QSharedPointer]<[[Qt_for_HarmonyOS/qtohosextras_doc/CheckResult_Class|CheckResult]]> FileShare::checkPersistent(const [https://doc.qt.io/qt-5/qlist.html QList]<[[Qt_for_HarmonyOS/qtohosextras_doc/PathPolicy_Class|PathPolicy]]> &''policies'') === | ||
Checks if file or folder permissions from ''policies'' have persistent permissions. The result check for each file or folder can be determined from [[CheckResult_Class|CheckResult]]. CheckResult::PathPolicyCheckResult::result will be set to <code>true</code> for each file or folder only for succesufull check and persistent permission found, <code>false</code> otherwise. | Checks if file or folder permissions from ''policies'' have persistent permissions. The result check for each file or folder can be determined from [[Qt_for_HarmonyOS/qtohosextras_doc/CheckResult_Class|CheckResult]]. CheckResult::PathPolicyCheckResult::result will be set to <code>true</code> for each file or folder only for succesufull check and persistent permission found, <code>false</code> otherwise. | ||
This function calls [https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/file_share-V5#oh_fileshare_checkpersistentpermission OH_FileShare_CheckPersistentPermission]. | This function calls [https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/file_share-V5#oh_fileshare_checkpersistentpermission OH_FileShare_CheckPersistentPermission]. | ||
To persist permission, use [[#persistPermission|persistPermission() | To persist permission, use [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#persistPermission|persistPermission]](). | ||
'''See also | '''See also '''[[Qt_for_HarmonyOS/qtohosextras_doc/CheckResult_Class|CheckResult]], [[Qt_for_HarmonyOS/qtohosextras_doc/PathPolicy_Class|PathPolicy]], and [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#persistPermission|persistPermission]](). | ||
=== <span id="deactivatePermission"></span>QSharedPointer<ActionResult> FileShare::deactivatePermission(const QList<PathPolicy> &''policies'') === | === <span id="deactivatePermission"></span>[https://doc.qt.io/qt-5/qsharedpointer.html QSharedPointer]<[[Qt_for_HarmonyOS/qtohosextras_doc/ActionResult_Class|ActionResult]]> FileShare::deactivatePermission(const [https://doc.qt.io/qt-5/qlist.html QList]<[[Qt_for_HarmonyOS/qtohosextras_doc/PathPolicy_Class|PathPolicy]]> &''policies'') === | ||
Deactivates file or folder permissions from ''policies''. The success of the action can be determined from [[ActionResult_Class|ActionResult]]. | Deactivates file or folder permissions from ''policies''. The success of the action can be determined from [[Qt_for_HarmonyOS/qtohosextras_doc/ActionResult_Class|ActionResult]]. | ||
This function calls [https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/file_share-V5#oh_fileshare_deactivatepermission OH_FileShare_DeactivatePermission]. | This function calls [https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/file_share-V5#oh_fileshare_deactivatepermission OH_FileShare_DeactivatePermission]. | ||
To activate permission, use [[ | To activate permission, use [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#activatePermission|activatePermission]](). | ||
'''See also '''[[Qt_for_HarmonyOS/qtohosextras_doc/ActionResult_Class|ActionResult]], [[Qt_for_HarmonyOS/qtohosextras_doc/PathPolicy_Class|PathPolicy]], and [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#activatePermission|activatePermission]](). | |||
=== <span id="persistPermission"></span>[https://doc.qt.io/qt-5/qsharedpointer.html QSharedPointer]<[[Qt_for_HarmonyOS/qtohosextras_doc/ActionResult_Class|ActionResult]]> FileShare::persistPermission(const [https://doc.qt.io/qt-5/qlist.html QList]<[[Qt_for_HarmonyOS/qtohosextras_doc/PathPolicy_Class|PathPolicy]]> &''policies'') === | |||
Persists file or folder permissions from ''policies''. The success of the action can be determined from [[Qt_for_HarmonyOS/qtohosextras_doc/ActionResult_Class|ActionResult]]. | |||
This function calls [https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/file_share-V5#oh_fileshare_persistpermission OH_FileShare_PersistPermission]. persistPermission() stores persistence data in the system database. After persistPermission() call, permissions are not yet active. Use [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#activatePermission|activatePermission]]() to activate permissions. persistPermission() must be called at least once before [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#activatePermission|activatePermission]](). | |||
To revoke a persistent permission, use [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#revokePermission|revokePermission]](). | |||
'''See also '''[[Qt_for_HarmonyOS/qtohosextras_doc/ActionResult_Class|ActionResult]], [[Qt_for_HarmonyOS/qtohosextras_doc/PathPolicy_Class|PathPolicy]], [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#revokePermission|revokePermission]](), and [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#activatePermission|activatePermission]](). | |||
=== <span id="revokePermission"></span>QSharedPointer<ActionResult> FileShare::revokePermission(const QList<PathPolicy> &''policies'') === | === <span id="revokePermission"></span>[https://doc.qt.io/qt-5/qsharedpointer.html QSharedPointer]<[[Qt_for_HarmonyOS/qtohosextras_doc/ActionResult_Class|ActionResult]]> FileShare::revokePermission(const [https://doc.qt.io/qt-5/qlist.html QList]<[[Qt_for_HarmonyOS/qtohosextras_doc/PathPolicy_Class|PathPolicy]]> &''policies'') === | ||
Revokes file or folder permissions from ''policies''. The success of the action can be determined from [[ActionResult_Class|ActionResult]]. | Revokes file or folder permissions from ''policies''. The success of the action can be determined from [[Qt_for_HarmonyOS/qtohosextras_doc/ActionResult_Class|ActionResult]]. | ||
This function calls [https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/file_share-V5#oh_fileshare_revokepermission OH_FileShare_RevokePermission]. | This function calls [https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/file_share-V5#oh_fileshare_revokepermission OH_FileShare_RevokePermission]. | ||
To persist permission, use [[ | To persist permission, use [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#persistPermission|persistPermission]](). | ||
'''See also '''[[Qt_for_HarmonyOS/qtohosextras_doc/ActionResult_Class|ActionResult]], [[Qt_for_HarmonyOS/qtohosextras_doc/PathPolicy_Class|PathPolicy]], and [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#persistPermission|persistPermission]](). | |||
[[Category:Qt for HarmonyOS]] | [[Category:Qt for HarmonyOS]] | ||
Latest revision as of 05:30, 17 September 2026
QtOhosExtras::FileShare
The FileShare to expose file permission API. More...
| Header: | #include <FileShare> |
| qmake: | QT += ohosextras |
| Since: | Qt 5.12.12 |
This namespace was introduced in Qt 5.12.12.
Classes
| class | ActionResult |
| class | CheckResult |
| struct | PathPolicy |
| struct | PathPolicyCheckResult |
| struct | PathPolicyErrorInfo |
Types
| enum class | OperationMode { Read, Write } |
| flags | OperationModes |
| enum class | PathPolicyError { Unknown, PersistenceForbidden, InvalidMode, InvalidPath, PermissionNotPersisted } |
Functions
| QSharedPointer<ActionResult> | activatePermission(const QList<PathPolicy> &policies) |
| QSharedPointer<CheckResult> | checkPersistent(const QList<PathPolicy> &policies) |
| QSharedPointer<ActionResult> | deactivatePermission(const QList<PathPolicy> &policies) |
| QSharedPointer<ActionResult> | persistPermission(const QList<PathPolicy> &policies) |
| QSharedPointer<ActionResult> | revokePermission(const QList<PathPolicy> &policies) |
Detailed Description
This API uses file system paths, which differ from the URIs used internally by HarmonyOS. For example, the path /data/storage/el1/bundle/entry/resources/resfile/test.txt will be converted to the URI file://com.your.example/data/storage/el1/bundle/entry/resources/resfile/test.txt , where com.your.example is app bundle name.
To learn more about file paths and URIs in HarmonyOS, see sandbox documentation.
Warning: This API relies on the underlying OHOS implementation. The following functions: persistPermission(), revokePermission(), activatePermission(), deactivatePermission(), and checkPersistent() may be unavailable on some devices. Additionally, there may be limitations on the maximum number of policies, and certain permissions may need to be explicitly granted to the application.
For more details and limitations, refer to the API documentation.
Classes
class ActionResult
The ActionResult class encapsulates the result of all file requested access permission actions. More...
class CheckResult
The CheckResult class encapsulates the result of all requested file access permission checks. More...
class PathPolicy
The PathPolicy struct encapsulates information required to request file access permissions for a specified path. More...
class PathPolicyCheckResult
The PathPolicyCheckResult struct contains the result of a file permission check request for a specified path, indicating whether access is granted or denied. More...
class PathPolicyErrorInfo
The PathPolicyErrorInfo struct contains the result of a file access permission request for a specified path. More...
Type Documentation
Defines permissions on path. See FileShare_OperationMode. The flags can be combined using bitwise operations.
| Constant | Value | Description |
|---|---|---|
QtOhosExtras::FileShare::OperationMode::Read
|
1 << 0
|
Read on path |
QtOhosExtras::FileShare::OperationMode::Write
|
1 << 1
|
Write on path |
This enum was introduced or modified in Qt 5.12.12.
The OperationModes type is a typedef for QFlags<OperationMode>. It stores an OR combination of OperationMode values.
See also PathPolicy.
Defines permission policy error codes. See FileShare_PolicyErrorCode.
| Constant | Value | Description |
|---|---|---|
QtOhosExtras::FileShare::PathPolicyError::Unknown
|
0
|
Error type is unknown or not recognized |
QtOhosExtras::FileShare::PathPolicyError::PersistenceForbidden
|
1
|
The permission on the path cannot be persisted |
QtOhosExtras::FileShare::PathPolicyError::InvalidMode
|
2
|
Invalid operation mode |
QtOhosExtras::FileShare::PathPolicyError::InvalidPath
|
3
|
Invalid path |
QtOhosExtras::FileShare::PathPolicyError::PermissionNotPersisted
|
4
|
The permission is not persisted |
This enum was introduced or modified in Qt 5.12.12.
See also PathPolicyErrorInfo.
Function Documentation
Activates file or folder permissions from policies. The success of the action can be determined from ActionResult.
This function calls OH_FileShare_ActivatePermission. Each time an application is started, its persistent permissions have not been loaded to the memory. Use this function to make a persistent permission active after the application is started. If the activation fails because the permission has not been persisted, use persistPermission() first.
To deactivate an active permission, use deactivatePermission().
See also ActionResult, PathPolicy, persistPermission(), and deactivatePermission().
Checks if file or folder permissions from policies have persistent permissions. The result check for each file or folder can be determined from CheckResult. CheckResult::PathPolicyCheckResult::result will be set to true for each file or folder only for succesufull check and persistent permission found, false otherwise.
This function calls OH_FileShare_CheckPersistentPermission.
To persist permission, use persistPermission().
See also CheckResult, PathPolicy, and persistPermission().
Deactivates file or folder permissions from policies. The success of the action can be determined from ActionResult.
This function calls OH_FileShare_DeactivatePermission.
To activate permission, use activatePermission().
See also ActionResult, PathPolicy, and activatePermission().
Persists file or folder permissions from policies. The success of the action can be determined from ActionResult.
This function calls OH_FileShare_PersistPermission. persistPermission() stores persistence data in the system database. After persistPermission() call, permissions are not yet active. Use activatePermission() to activate permissions. persistPermission() must be called at least once before activatePermission().
To revoke a persistent permission, use revokePermission().
See also ActionResult, PathPolicy, revokePermission(), and activatePermission().
Revokes file or folder permissions from policies. The success of the action can be determined from ActionResult.
This function calls OH_FileShare_RevokePermission.
To persist permission, use persistPermission().
See also ActionResult, PathPolicy, and persistPermission().