company logo

DatabaseContext :: 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 database context class.

When the context handle does not refer to a valid context instance the function throws an exception.

Return value:  Return code from main function ( int  )

Implementation overview

Implementation details

  1. Check permission for global action
    int32 DatabaseContext  :: 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.

  2. to list
  3. Check permission for context action
    int32 DatabaseContext  :: 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.

  4. to list