Tizen Native API  5.5
Privilege Info

Requires Header

#include <privilege_information.h>

Overview

A library for reading privilege information of the given privilege and API issue version. It provides the display name or description of privileges. If there's no matching privilege then it shows last token of given privilege or description string for undefined privileges.

Related Features

This API is related with the following features:

  • http://tizen.org/feature/security.privacy_privilege
    It is recommended to design feature related codes in your application for reliability.
    You can check if a device supports the related features for this API by using System Information, and control your application's actions accordingly.
    To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.
    More details on featuring your application can be found from Feature Element.

Functions

int privilege_info_get_display_name (const char *api_version, const char *privilege, char **display_name)
 Gets the display name of the given privilege.
int privilege_info_get_display_name_by_pkgtype (const char *package_type, const char *api_version, const char *privilege, char **display_name)
 Gets the display name of the given privilege.
int privilege_info_get_description (const char *api_version, const char *privilege, char **description)
 Gets the description of the given privilege.
int privilege_info_get_description_by_pkgtype (const char *package_type, const char *api_version, const char *privilege, char **description)
 Gets the description of the given privilege.
int privilege_info_get_privacy_display_name (const char *privilege, char **privacy_name)
 Gets the display name of the privacy group in which the given privilege is included.
int privilege_info_get_privacy_privilege_status (const char *privilege, bool *status)
 Gets the status of the given privacy related privilege.
int privilege_info_get_privilege_info_list (const char *locale, GList *privilege_name_list, GList **privilege_info_list, privilege_consumer_return_code_e *return_result)
 Gets the privilege information list of the given locale and privileges.
int privilege_info_free_privilege_info_list (GList *privilege_info_list)
 Destroys the privilege information list.

Typedefs

typedef struct _privilege_info_s privilege_info_s
 The structure for privilege information.

Typedef Documentation

The structure for privilege information.

Since :
5.5

Enumeration Type Documentation

Enumeration for return code to be sent to consumer.

Since :
5.5
Enumerator:
PRIVILEGE_CONSUMER_RETURN_CODE_SUCCESS 

Successful

PRIVILEGE_CONSUMER_RETURN_CODE_UNKNOWN_LOCALE_CODE 

Unknown locale code.

PRIVILEGE_CONSUMER_RETURN_CODE_INVALID_PARAMETER 

Invalid parameter.

Enumeration for error code for Privilege Information.

Since :
2.3
Enumerator:
PRVINFO_ERROR_NONE 

Successful

PRVINFO_ERROR_INVALID_PARAMETER 

Invalid function parameter

PRVINFO_ERROR_OUT_OF_MEMORY 

Out of memory

PRVINFO_ERROR_INTERNAL_ERROR 

Unknown error

PRVINFO_ERROR_NOT_SUPPORTED 

Not supported (Since 5.0)


Function Documentation

int privilege_info_free_privilege_info_list ( GList *  privilege_info_list)

Destroys the privilege information list.

Since :
5.5
Remarks:
If privilege_info_list is NULL, no operation is performed and PRVINFO_ERROR_INVALID_PARAMETER will be returned.
Parameters:
[in]privilege_info_listThe privilege information list to destroy
Returns:
0 on success, otherwise a negative error value.
Return values:
PRVINFO_ERROR_NONESuccessful
PRVINFO_ERROR_INVALID_PARAMETERInvalid function parameter
int privilege_info_get_description ( const char *  api_version,
const char *  privilege,
char **  description 
)

Gets the description of the given privilege.

Since :
2.3
Remarks:
description must be released using free().
Parameters:
[in]api_versionThe API version of the application to get privilege information
[in]privilegeThe privilege
[out]descriptionThe description of the privilege
Returns:
0 on success, otherwise a negative error value
Return values:
PRVINFO_ERROR_NONESuccessful
PRVINFO_ERROR_OUT_OF_MEMORYOut of memory
PRVINFO_ERROR_INVALID_PARAMETERInvalid function parameter
PRVINFO_ERROR_INTERNAL_ERRORUnknown error
int privilege_info_get_description_by_pkgtype ( const char *  package_type,
const char *  api_version,
const char *  privilege,
char **  description 
)

Gets the description of the given privilege.

Since :
2.3
Remarks:
description must be released using free().
package_type must be one of followings: "PRVINFO_PACKAGE_TYPE_NATIVE", "PRVINFO_PACKAGE_TYPE_WEB"
Parameters:
[in]package_typeThe type of application package
[in]api_versionThe API version of the application to get privilege information
[in]privilegeThe privilege
[out]descriptionThe description of the privilege
Returns:
0 on success, otherwise a negative error value
Return values:
PRVINFO_ERROR_NONESuccessful
PRVINFO_ERROR_OUT_OF_MEMORYOut of memory
PRVINFO_ERROR_INVALID_PARAMETERInvalid function parameter
PRVINFO_ERROR_INTERNAL_ERRORUnknown error
int privilege_info_get_display_name ( const char *  api_version,
const char *  privilege,
char **  display_name 
)

Gets the display name of the given privilege.

Since :
2.3
Remarks:
display_name must be released using free().
Parameters:
[in]api_versionThe API version of the application to get privilege information
[in]privilegeThe privilege
[out]display_nameThe display name of the privilege
Returns:
0 on success, otherwise a negative error value
Return values:
PRVINFO_ERROR_NONESuccessful
PRVINFO_ERROR_OUT_OF_MEMORYOut of memory
PRVINFO_ERROR_INVALID_PARAMETERInvalid function parameter
PRVINFO_ERROR_INTERNAL_ERRORUnknown error
int privilege_info_get_display_name_by_pkgtype ( const char *  package_type,
const char *  api_version,
const char *  privilege,
char **  display_name 
)

Gets the display name of the given privilege.

Since :
2.3
Remarks:
display_name must be released using free().
package_type must be one of followings: "PRVINFO_PACKAGE_TYPE_NATIVE", "PRVINFO_PACKAGE_TYPE_WEB"
Parameters:
[in]package_typeThe type of application package
[in]api_versionThe API version of the application to get privilege information
[in]privilegeThe privilege
[out]display_nameThe display name of the privilege
Returns:
0 on success, otherwise a negative error value
Return values:
PRVINFO_ERROR_NONESuccessful
PRVINFO_ERROR_OUT_OF_MEMORYOut of memory
PRVINFO_ERROR_INVALID_PARAMETERInvalid function parameter
PRVINFO_ERROR_INTERNAL_ERRORUnknown error
int privilege_info_get_privacy_display_name ( const char *  privilege,
char **  privacy_name 
)

Gets the display name of the privacy group in which the given privilege is included.

Since :
3.0
Remarks:
privacy_name must be released using free().
privilege must be privacy related, otherwise PRVINFO_ERROR_INVALID_PARAMETER is returned.
Parameters:
[in]privilegeThe privilege
[out]privacy_nameThe privacy group's display name that the given privilege is included in
Returns:
0 on success, otherwise a negative error value
Return values:
PRVINFO_ERROR_NONESuccessful
PRVINFO_ERROR_OUT_OF_MEMORYOut of memory
PRVINFO_ERROR_INVALID_PARAMETERInvalid function parameter
PRVINFO_ERROR_INTERNAL_ERRORUnknown error
PRVINFO_ERROR_NOT_SUPPORTEDNot supported
int privilege_info_get_privacy_privilege_status ( const char *  privilege,
bool *  status 
)

Gets the status of the given privacy related privilege.

Deprecated:
Deprecated since 5.0. Use ppm_check_permission() instead. You can refer to Privacy Privilege Manager.
Since :
3.0
Remarks:
privilege must be privacy related, otherwise PRVINFO_ERROR_INVALID_PARAMETER is returned. In case of errors, status is set to true.
Parameters:
[in]privilegeThe privilege
[out]statustrue if the privilege is on, and false if the privilege is off
Returns:
0 on success, otherwise a negative error value
Return values:
PRVINFO_ERROR_NONESuccessful
PRVINFO_ERROR_INVALID_PARAMETERInvalid function parameter
PRVINFO_ERROR_INTERNAL_ERRORUnknown error
PRVINFO_ERROR_NOT_SUPPORTEDNot supported
int privilege_info_get_privilege_info_list ( const char *  locale,
GList *  privilege_name_list,
GList **  privilege_info_list,
privilege_consumer_return_code_e return_result 
)

Gets the privilege information list of the given locale and privileges.

If the given locale is not recognized, return_result is set to PRIVILEGE_CONSUMER_RETURN_CODE_UNKNOWN_LOCALE_CODE and the result in the privilege_info_list is provided according to the current locale. If all of the privileges in privilege_name_list are invalid then return_result is set to PRIVILEGE_CONSUMER_RETURN_CODE_INVALID_PARAMETER. Otherwise, return_result is set to PRIVILEGE_CONSUMER_RETURN_CODE_SUCCESS. If some of the privileges in privilege_name_list are invalid then corresponding elements in the privilege_info_list will have the display_name and the description set to an empty string.

Since :
5.5
Remarks:
You must destroy the newly created privilege_info_list by calling privilege_info_free_privilege_info_list() if it is no longer needed.
Parameters:
[in]localeThe locale information
[in]privilege_name_listThe privilege name list
[out]privilege_info_listThe privilege information list of the given locale and privileges
[out]return_resultThe return code to be sent to consumer.
Returns:
0 on success, otherwise a negative error value.
Return values:
PRVINFO_ERROR_NONESuccessful
PRVINFO_ERROR_OUT_OF_MEMORYOut of memory
PRVINFO_ERROR_INVALID_PARAMETERInvalid function parameter
PRVINFO_ERROR_INTERNAL_ERRORUnknown error
See also:
privilege_info_free_privilege_info_list()
privilege_consumer_return_code_e