Datasnap.DSSession.TDSSession.GetAuthRoleInternal
Delphi
procedure GetAuthRoleInternal(ServerMethod: TDSServerMethod; AuthManager : TDSCustomAuthenticationManager;
out AuthorizedRoles, DeniedRoles: TStrings);
C++
void __fastcall GetAuthRoleInternal(Datasnap::Dscommonserver::TDSServerMethod* ServerMethod, Datasnap::Dsauth::TDSCustomAuthenticationManager* AuthManager, /* out */ System::Classes::TStrings* &AuthorizedRoles, /* out */ System::Classes::TStrings* &DeniedRoles);
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
procedure function |
protected | Datasnap.DSSession.pas Datasnap.DSSession.hpp |
Datasnap.DSSession | TDSSession |
Description
Returns authorized and denied roles for a given server method, and caches the result.
GetAuthRoleInternal takes in a server method and an authentication manager. Using these, it builds or finds an appropriate TRoleAuth instance to use to populate the AuthorizedRoles
and DeniedRoles
output parameters.
The AuthRole property of TDSMethodInfo can hold a cached TRoleAuth that should be used for the method. However, if one is cached here and it is a design-time role, then GetAuthRoleInternal makes sure that this role reflects the most current state of the Roles attribute of the authentication manager. If the TRoleAuth is outdated, it is replaced in the AuthRole property with a new one, which is created using the current state of the Roles collection.
If the cached item is a TRoleAuth created by an attribute in code, then this will be replaced by a design-time TRoleAuth instance, if one can be created with at least one authorized or denied role from the design-time Roles collection on the authentication manager.
If no TRoleAuth exists in the AuthRole property and none can be created by the Roles collection, then if a TRoleAuth exists as an attribute for the method, it is stored in AuthRole and used. Otherwise, an empty TRoleAuth is created and cached.