ProjectContext :: permitted - Check action permission
The function returns, whether the application is allowed to call the action passed in sActionName (and sTypeName ) ( 1 ) or not ( 0 ). The function is called internally before executing an action or function.
In order to perform permission checks, those have to be implemented in the database context class, which will cache permissions by action and context class name ( sActionName , sTypeName ). Only protected actions ( protectAction() ) will be checked by calling the permitted() function. After being checked once, the action will be registered as disabled or enabled action (internal optimization). In order reset the action's enabled/disabled state (e.g. when changing the active user in an application), resetPermissions() may be called.
In order to perform application specific permission checks, the permitted() function has to be overloaded in a project context class.
When the context handle does not refer to a valid context instance the function throws an exception.
A return code 0 indicates, that the function was terminated successfully. All other return codes indicate an error.
Implementation overview
- Check permission for global action
ProjectContext :: permitted ( sActionName ) - Check permission for context action
ProjectContext :: permitted ( sActionName, sTypeName )
Implementation details
-
Check permission for global action
int32 ProjectContext  :: permitted ( odaba::String &sActionName )
A permission check for a global action is required, when the action is not called in a specific context.
- sActionName
- Action name
The action name is a name of an action implemented in the context class related to the database source or implemented as default action. Actions can be implemented as expressions, as C++ functions or as .NET function.
In order to pass no action name, an empty string ( String () ) may be passed.
to list
- sActionName
- Action name
-
Check permission for context action
int32 ProjectContext  :: permitted ( odaba::String &sActionName, odaba::String &sTypeName )
In order to protect a certain context class action, the context class name has to be passed in sTypeName in addition to the action name ( sActionName ). In this case, the action is protected in the given context, only.
- sActionName
- Action name
The action name is a name of an action implemented in the context class related to the database source or implemented as default action. Actions can be implemented as expressions, as C++ functions or as .NET function.
In order to pass no action name, an empty string ( String () ) may be passed.
- sTypeName
- Type name
The type name is the name of a data type (usually) defined in the database. The type name might be passed as simple identifier or as scoped name with preceding namespace names separated by double colon '::'.
In order to pass no type name, an empty string ( String() ) may be passed.
to list
- sActionName
- Action name