AccessToken权限校验

Signed-off-by: wuqi0105 <wuqi85@huawei.com>
This commit is contained in:
wuqi0105
2022-02-24 16:10:21 +08:00
parent b07c5f9d98
commit 1cb6db403e
5 changed files with 19 additions and 19 deletions
@@ -50,7 +50,7 @@ int32_t DeviceManagerService::Init()
return DM_INT_MULTIPLE;
}
if (!PermissionManager::GetInstance().checkPermission()) {
if (!PermissionManager::GetInstance().CheckPermission()) {
LOGI("The caller does not have permission to call");
return DM_NO_PERMISSION;
}
@@ -129,7 +129,7 @@ int32_t DeviceManagerService::Init()
int32_t DeviceManagerService::GetTrustedDeviceList(const std::string &pkgName, const std::string &extra,
std::vector<DmDeviceInfo> &deviceList)
{
if (!PermissionManager::GetInstance().checkPermission()) {
if (!PermissionManager::GetInstance().CheckPermission()) {
LOGI("The caller does not have permission to call");
return DM_NO_PERMISSION;
}
@@ -146,7 +146,7 @@ int32_t DeviceManagerService::GetTrustedDeviceList(const std::string &pkgName, c
int32_t DeviceManagerService::GetLocalDeviceInfo(DmDeviceInfo &info)
{
if (!PermissionManager::GetInstance().checkPermission()) {
if (!PermissionManager::GetInstance().CheckPermission()) {
LOGI("The caller does not have permission to call");
return DM_NO_PERMISSION;
}
@@ -192,7 +192,7 @@ int32_t DeviceManagerService::GetUuidByNetworkId(const std::string &pkgName, con
int32_t DeviceManagerService::StartDeviceDiscovery(const std::string &pkgName, const DmSubscribeInfo &subscribeInfo,
const std::string &extra)
{
if (!PermissionManager::GetInstance().checkPermission()) {
if (!PermissionManager::GetInstance().CheckPermission()) {
LOGI("The caller does not have permission to call");
return DM_NO_PERMISSION;
}
@@ -209,7 +209,7 @@ int32_t DeviceManagerService::StartDeviceDiscovery(const std::string &pkgName, c
int32_t DeviceManagerService::StopDeviceDiscovery(const std::string &pkgName, uint16_t subscribeId)
{
if (!PermissionManager::GetInstance().checkPermission()) {
if (!PermissionManager::GetInstance().CheckPermission()) {
LOGI("The caller does not have permission to call");
return DM_NO_PERMISSION;
}
@@ -227,7 +227,7 @@ int32_t DeviceManagerService::StopDeviceDiscovery(const std::string &pkgName, ui
int32_t DeviceManagerService::AuthenticateDevice(const std::string &pkgName, int32_t authType,
const std::string &deviceId, const std::string &extra)
{
if (!PermissionManager::GetInstance().checkPermission()) {
if (!PermissionManager::GetInstance().CheckPermission()) {
LOGI("The caller does not have permission to call");
return DM_NO_PERMISSION;
}
@@ -248,7 +248,7 @@ int32_t DeviceManagerService::AuthenticateDevice(const std::string &pkgName, int
int32_t DeviceManagerService::UnAuthenticateDevice(const std::string &pkgName, const std::string &deviceId)
{
if (!PermissionManager::GetInstance().checkPermission()) {
if (!PermissionManager::GetInstance().CheckPermission()) {
LOGI("The caller does not have permission to call");
return DM_NO_PERMISSION;
}
@@ -269,7 +269,7 @@ int32_t DeviceManagerService::UnAuthenticateDevice(const std::string &pkgName, c
int32_t DeviceManagerService::VerifyAuthentication(const std::string &authParam)
{
if (!PermissionManager::GetInstance().checkPermission()) {
if (!PermissionManager::GetInstance().CheckPermission()) {
LOGI("The caller does not have permission to call");
return DM_NO_PERMISSION;
}
@@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef OHOS_DM_PERMISSION_TOKEN_H
#define OHOS_DM_PERMISSION_TOKEN_H
#ifndef OHOS_DM_PERMISSION_MANAGER_H
#define OHOS_DM_PERMISSION_MANAGER_H
#include "single_instance.h"
@@ -24,8 +24,8 @@ class PermissionManager {
DECLARE_SINGLE_INSTANCE(PermissionManager);
public:
bool checkPermission(void);
bool CheckPermission(void);
};
} // namespace DistributedHardware
} // namespace OHOS
#endif // OHOS_DM_PERMISSION_TOKEN_H
#endif // OHOS_DM_PERMISSION_MANAGER_H
@@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef OHOS_DM_PERMISSION_TOKEN_H
#define OHOS_DM_PERMISSION_TOKEN_H
#ifndef OHOS_DM_PERMISSION_MANAGER_H
#define OHOS_DM_PERMISSION_MANAGER_H
#include "single_instance.h"
@@ -24,8 +24,8 @@ class PermissionManager {
DECLARE_SINGLE_INSTANCE(PermissionManager);
public:
bool checkPermission(void);
bool CheckPermission(void);
};
} // namespace DistributedHardware
} // namespace OHOS
#endif // OHOS_DM_PERMISSION_TOKEN_H
#endif // OHOS_DM_PERMISSION_MANAGER_H
@@ -19,7 +19,7 @@ namespace OHOS {
namespace DistributedHardware {
IMPLEMENT_SINGLE_INSTANCE(PermissionManager);
bool PermissionManager::checkPermission(void)
bool PermissionManager::CheckPermission(void)
{
return true;
}
@@ -37,9 +37,9 @@ namespace OHOS {
namespace DistributedHardware {
IMPLEMENT_SINGLE_INSTANCE(PermissionManager);
bool PermissionManager::checkPermission(void)
bool PermissionManager::CheckPermission(void)
{
LOGI("Enter PermissionManager::checkPermission");
LOGI("Enter PermissionManager::CheckPermission");
AccessTokenID tokenCaller = IPCSkeleton::GetCallingTokenID();
if (tokenCaller == 0) {
LOGI("PermissionManager::tokenCaller == 0");