PMS

Overview

Manages permissions.

This module provides interfaces for managing permissions of third-party applications.

Since:

1.0

Version:

1.0

Summary

Files

File Name

Description

pms_interface.h

Declares interfaces for managing permissions.

Functions

Function Name

Description

CheckPermission (int taskID, const char permissionName)

int 

Checks whether the caller (generally a third-party application) has a specified permission of a system service API.

QueryPermission (const char identifier, PermissionSaved*permissions, int permNum)

int 

Queries all permissions requested by the application and checks whether these permissions are granted.

GrantPermission (const char identifier, const char permName)

int 

Grants a specified permission to the application.

RevokePermission (const char identifier, const char permName)

int 

Revokes a specified permission from the application.

GrantRuntimePermission (int taskID, const char permissionName)

int 

Grants a specified runtime permission to an application.

RequestPermission (int taskID, const char permissionName)

int 

Requests a specified permission.

Details

Function Documentation

CheckPermission()

  1. intCheckPermission(int taskID,constchar* permissionName )

Description:

Checks whether the caller (generally a third-party application) has a specified permission of a system service API.

Parameters:

Name

Description

taskIdIndicates the process ID of the caller. The range is [0, INT_MAX].
permissionNameIndicates the pointer to the permission name. For details, see the developer documentation.

Returns:

Returns 1 if the caller has the permission; returns 0 otherwise.

GrantPermission()

  1. intGrantPermission(constchar* identifier,constchar* permName )

Description:

Grants a specified permission to the application.

Parameters:

Name

Description

identifierIndicates the pointer to the application bundle name.
permNameIndicates the pointer to the permission name. For details, see the developer documentation.

Returns:

Returns 0 if the permission is successfully granted; returns an error code defined in PmsErrorCode otherwise.

GrantRuntimePermission()

  1. intGrantRuntimePermission(int taskID,constchar* permissionName )

Description:

Grants a specified runtime permission to an application.

This function applies to sensitive permissions that can be granted to the application only when the application is running.

Parameters:

Name

Description

taskIdIndicates the process ID of the application. The range is [0, INT_MAX].
permissionNameIndicates the pointer to the permission name. For details, see the developer documentation.

Returns:

Returns 0 if the permission is successfully granted; returns an error code defined in PmsErrorCode otherwise.

QueryPermission()

  1. intQueryPermission(constchar* identifier,[PermissionSaved]($api-api-SmartVision-Devices-PermissionSaved.md)** permissions,int* permNum )

Description:

Queries all permissions requested by the application and checks whether these permissions are granted.

Parameters:

Name

Description

identifierIndicates the pointer to the application bundle name.
permissionsIndicates the double pointer to the array of permissions. You need to pass the PermissionSaved pointer and release it after finishing using it.
permNumIndicates the pointer to the number of permissions in the array, which is an integer.

Returns:

Returns 0 if the operation is successful; returns an error code defined in PmsErrorCode otherwise.

RequestPermission()

  1. intRequestPermission(int taskID,constchar* permissionName )

Description:

Requests a specified permission.

Parameters:

Name

Description

taskIdIndicates the process ID of the application. The range is [0, INT_MAX].
permissionNameIndicates the pointer to the permission name. For details, see the developer documentation.

Returns:

Returns 0 if the operation is successful; returns an error code defined in PmsErrorCode otherwise.

RevokePermission()

  1. intRevokePermission(constchar* identifier,constchar* permName )

Description:

Revokes a specified permission from the application.

Parameters:

Name

Description

identifierIndicates the pointer to the application bundle name.
permNameIndicates the pointer to the permission name. For details, see the developer documentation.

Returns:

Returns 0 if the permission is successfully revoked; returns an error code defined in PmsErrorCode otherwise.