PLCnext API Documentation 23.6.0.37
Public Types | Public Member Functions | Static Public Member Functions | List of all members
Arp::System::Um::Services::IAuthorizationInfoService Class Referenceabstract

This service checks if a session has particular permissions for protected entity operations. More...

#include <IAuthorizationInfoService.hpp>

Inheritance diagram for Arp::System::Um::Services::IAuthorizationInfoService:
Inheritance graph

Public Types

using Ptr = std::shared_ptr< IAuthorizationInfoService >
 
- Public Types inherited from Arp::System::Rsc::Services::IRscService
typedef std::shared_ptr< IRscServicePtr
 

Public Member Functions

 IAuthorizationInfoService (void)=default
 Constructs an IAuthorizationInfoService instance.
 
virtual boolean HasPermissionFor (const RscString< 512 > &entity, Operation operation, SecurityToken securityToken)=0
 Checks if the specified session has permission to execute particular entity operations, e.g. calling Rsc service operations, accessing files, reading data. Note: This method must not be called remotely via the RSC-Gateway and will throw an exception if attempted. More...
 
- Public Member Functions inherited from Arp::System::Rsc::Services::IRscService
 IRscService (void)=default
 Constructs an IRscService instance.
 
virtual ~IRscService (void)=default
 Destructs this instance and frees all resouces.
 

Static Public Member Functions

static IRscServiceProxyFactory & GetProxyFactory (void)
 
- Static Public Member Functions inherited from Arp::System::Rsc::Services::IRscService
static IRscServiceProxyFactory & GetProxyFactory (void)
 Returns a reference to service proxy factory to create a proxy instance of the service More...
 

Detailed Description

This service checks if a session has particular permissions for protected entity operations.

This service is only usable from the SDK for other processes running on the same PLC; it is not intended for remote (client) use over the RSC-Gateway.
All code snippets are written for C++ usage.

This service is defined in library Arp.System.Um.

Realtime Usage: This API call does not have to be deterministic in runtime behaviour, so an asynchronous execution should be considered.

Member Function Documentation

◆ HasPermissionFor()

virtual boolean Arp::System::Um::Services::IAuthorizationInfoService::HasPermissionFor ( const RscString< 512 > &  entity,
Operation  operation,
SecurityToken  securityToken 
)
pure virtual

Checks if the specified session has permission to execute particular entity operations, e.g. calling Rsc service operations, accessing files, reading data. Note: This method must not be called remotely via the RSC-Gateway and will throw an exception if attempted.

The example below checks permission for a user on an non-existant(!) service.
The Securitytoken to check on is initialized by logging in as the user themselves (ex. Arp.System.Um.Services.IPasswordAuthenticationService)
or by converting the user's session to a SecurityToken Arp.System.Um.Services.ISessionService. Checking for users permissions on SecurityToken userToken = ... //see summary IAuthorizationInfoService authorizationInfoService = ... // subscribe to service auto userCanAccessService = authorizationInfoService.HasPermissionFor("arp.rsc.gateway/Arp/Arp.System.Um.Services.ITestService/GetTestData", Operation::Call, userToken);

Parameters
entityThe protected entity to check the permission for, e.g. Rsc service operations, files, Gds data points. See default permission-config file on a target for examples.
operationThe operation to be executed on the entity.

The operation to be executed on the entity, like Arp.System.Um.Services.Operation.Call to invoke Rsc services or Arp.System.Um.Services.Operation.ReadValue to read values of Gds data points. All values of this enum can be found at Arp.System.Um.Services.Operation.

Parameters
securityTokenThe security token of the session to check the permission for, which has been obtained through Arp.System.Um.Services.IPasswordAuthenticationService
Returns
true if the access is granted, otherwise false.

The documentation for this class was generated from the following file: