//
-// Open Service Platform
// Copyright (c) 2012 Samsung Electronics Co., Ltd.
//
// Licensed under the Apache License, Version 2.0 (the License);
//
/**
- * @if VISPARTNER
* @file FSecAccessController.h
* @brief This is the header file for the %AccessController class.
*
* This header file contains the declarations of the %AccessController class.
- * @endif
*/
#ifndef _FSEC_ACCESS_CONTROLLER_H_
#define _FSEC_ACCESS_CONTROLLER_H_
#include <FOspConfig.h>
+#include <FAppTypes.h>
namespace Tizen { namespace Security
{
+class _PrivilegeManager;
+
/**
- * @if VISPARTNER
* @class AccessController
- * @brief This class provides a way to check the privilege and visibility of privileged API.
- * @since 2.0
- * @visibility partner
+ * @brief This class provides methods to check the privilege of privileged API.
+ * @since 2.0
*
- * The %AccessController class provides a way to check the privilege and visibility of privileged API.
- * @endif
+ * The %AccessController class provides methods to check the privilege of privileged API.
*/
class _OSP_EXPORT_ AccessController
{
public:
/**
- * @if VISPARTNER
- *
- * Checks whether the application has a privilege and a visibility to invoke the privileged API.
+ * Checks whether the application has a privilege to invoke the privileged API.
*
* @since 2.0
- * @visibility partner
* @return An error code
- * @param[in] privilege A value of enumerator of the specified @c privilege
- * @exception E_SUCCESS The method is successful and the request is granted.
- * @exception E_DATA_NOT_FOUND The privilege information does not exist.
- * @exception E_OUT_OF_MEMORY The memory is insufficient.
- * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
- * @exception E_SYSTEM An unexpected system error has occurred.
- * @endif
+ * @param[in] privilege A value of enumerator of the specified @c privilege
+ * @exception E_SUCCESS The method is successful and the request is granted.
+ * @exception E_DATA_NOT_FOUND The privilege information does not exist.
+ * @exception E_OUT_OF_MEMORY The memory is insufficient.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_USER_NOT_CONSENTED The user has blocked the application from calling this method.
+ * @exception E_SYSTEM An unexpected system error has occurred.
*/
static result CheckPrivilege(int privilege);
+ /**
+ * Checks whether the application has a privilege to invoke the privileged API.
+ *
+ * @since 2.1
+ * @return An error code
+ * @param[in] privilege A string of the specified privilege
+ * @exception E_SUCCESS The method is successful and the request is granted.
+ * @exception E_INVALID_ARG The specified @c privilege is an invalid privilege string.
+ * @exception E_DATA_NOT_FOUND The privilege information does not exist.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_USER_NOT_CONSENTED The user has blocked the application from calling this method.
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ */
+ static result CheckPrivilege(const Tizen::Base::String& privilege);
+
+
+ /**
+ * Checks whether the client application with the specified @c packageId has a privilege to invoke the privileged API.
+ *
+ * @since 2.1
+ * @privlevel partner
+ * @privilege %http://tizen.org/privilege/privilegemanager.read
+ *
+ * @return An error code
+ * @param[in] packageId The package ID
+ * @param[in] privilege A string of the specified privilege
+ * @exception E_SUCCESS The method is successful and the request is granted.
+ * @exception E_INVALID_ARG The specified @c privilege is an invalid privilege string.
+ * @exception E_DATA_NOT_FOUND The privilege information does not exist.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_USER_NOT_CONSENTED The user has blocked the application from calling this method.
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ */
+ static result CheckPrivilege(const Tizen::App::PackageId& packageId, const Tizen::Base::String& privilege);
+
private:
/**
AccessController(const AccessController& rhs);
/**
- * The implementation of this copy assignment operator is intentionally blank and delcared as private to prohibit copying of objects.
+ * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
*/
AccessController& operator =(const AccessController& rhs);
+ static void InitIpcClient(void);
static void Initialize(void);
+private:
+ static _PrivilegeManager* __pPrivilegeManager;
+
}; // AccessController
}} // Tizen::Security