mirror of
https://github.com/openharmony/accesscontrol_accesscontrol_cangjie_wrapper.git
synced 2026-06-30 20:47:57 -04:00
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Copyright (c) 2026 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package ohos.ability_access_ctrl
|
||||
|
||||
import ohos.app.ability.ui_ability.UIAbilityContext
|
||||
import ohos.business_exception.AsyncCallback
|
||||
import ohos.labels.APILevel
|
||||
public import ohos.security.permission_request_result.*
|
||||
import ohos.security.permission_request_result.*
|
||||
|
||||
public type Permissions = String
|
||||
|
||||
@!APILevel[since: "22", syscap: "SystemCapability.Security.AccessToken"]
|
||||
public enum GrantStatus {
|
||||
@!APILevel[since: "22", syscap: "SystemCapability.Security.AccessToken"]
|
||||
PermissionDenied
|
||||
| @!APILevel[since: "22", syscap: "SystemCapability.Security.AccessToken"]
|
||||
PermissionGranted
|
||||
| ...
|
||||
}
|
||||
|
||||
extend GrantStatus <: ToString {
|
||||
@!APILevel[since: "22", syscap: "SystemCapability.Security.AccessToken"]
|
||||
public func toString(): String {
|
||||
return String()
|
||||
}
|
||||
}
|
||||
|
||||
extend GrantStatus <: Equatable<GrantStatus> {
|
||||
@!APILevel[since: "22", syscap: "SystemCapability.Security.AccessToken"]
|
||||
public operator func ==(other: GrantStatus): Bool {
|
||||
return true
|
||||
}
|
||||
|
||||
@!APILevel[since: "22", syscap: "SystemCapability.Security.AccessToken"]
|
||||
public operator func !=(other: GrantStatus): Bool {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
@!APILevel[since: "22", syscap: "SystemCapability.Security.AccessToken"]
|
||||
public class AbilityAccessCtrl {
|
||||
@!APILevel[since: "22", syscap: "SystemCapability.Security.AccessToken"]
|
||||
public static func createAtManager(): AtManager {
|
||||
return AtManager()
|
||||
}
|
||||
|
||||
public init() {
|
||||
super()
|
||||
}
|
||||
}
|
||||
|
||||
@!APILevel[since: "22", syscap: "SystemCapability.Security.AccessToken"]
|
||||
public class AtManager {
|
||||
@!APILevel[since: "22", syscap: "SystemCapability.Security.AccessToken", throwexception: true]
|
||||
public func checkAccessToken(tokenID: UInt32, permissionName: Permissions): GrantStatus {
|
||||
return GrantStatus.PermissionDenied
|
||||
}
|
||||
|
||||
@!APILevel[since: "22", syscap: "SystemCapability.Security.AccessToken", throwexception: true]
|
||||
public func requestPermissionsFromUser(context: UIAbilityContext, permissionList: Array<Permissions>,
|
||||
requestCallback: AsyncCallback<PermissionRequestResult>): Unit {
|
||||
return ()
|
||||
}
|
||||
|
||||
public init() {
|
||||
super()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (c) 2026 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package ohos.security.permission_request_result
|
||||
|
||||
import ohos.labels.APILevel
|
||||
|
||||
@!APILevel[since: "22", syscap: "SystemCapability.Security.AccessToken"]
|
||||
public class PermissionRequestResult {
|
||||
@!APILevel[since: "22", syscap: "SystemCapability.Security.AccessToken"]
|
||||
public var permissions: Array<String>
|
||||
|
||||
@!APILevel[since: "22", syscap: "SystemCapability.Security.AccessToken"]
|
||||
public var authResults: Array<Int32>
|
||||
|
||||
@!APILevel[since: "22", syscap: "SystemCapability.Security.AccessToken"]
|
||||
public var dialogShownResults = Array<Bool>()
|
||||
|
||||
public init() {
|
||||
super()
|
||||
this.permissions = Array()
|
||||
this.authResults = Array()
|
||||
}
|
||||
}
|
||||
@@ -16,10 +16,15 @@
|
||||
import("//build/templates/cangjie/cjc.gni")
|
||||
|
||||
ohos_cangjie_shared_library("ohos.ability_access_ctrl") {
|
||||
sources = [
|
||||
"cj_ability_access_ctrl.cj",
|
||||
"cj_ability_access_ctrl_error.cj",
|
||||
]
|
||||
|
||||
if (is_mingw || is_mac){
|
||||
sources = [ "../../mock/ohos.ability_access_ctrl.cj" ]
|
||||
} else {
|
||||
sources = [
|
||||
"cj_ability_access_ctrl.cj",
|
||||
"cj_ability_access_ctrl_error.cj",
|
||||
]
|
||||
}
|
||||
|
||||
cj_deps = [ "../security/permission_request_result:ohos.security.permission_request_result" ]
|
||||
|
||||
|
||||
@@ -16,7 +16,12 @@
|
||||
import("//build/templates/cangjie/cjc.gni")
|
||||
|
||||
ohos_cangjie_shared_library("ohos.security.permission_request_result") {
|
||||
sources = [ "permission_request_result.cj" ]
|
||||
|
||||
if (is_mingw || is_mac){
|
||||
sources = [ "../../../mock/ohos.security.permission_request_result.cj" ]
|
||||
} else {
|
||||
sources = [ "permission_request_result.cj" ]
|
||||
}
|
||||
|
||||
cj_external_deps = [
|
||||
"cangjie_ark_interop:ohos.business_exception",
|
||||
|
||||
Reference in New Issue
Block a user