Restrict (element)

From JRapid

Jump to: navigation, search

restrict is an element.

Contents

Description

The "restrict" element is used to indicate the necessary user privileges to access a page. As a consequence, it is useful only when the application defines users, roles and privileges.

If defined inside an entity, the restriction will we applied only to its listings and forms. If defined inside a panel, the restriction will be applied only to that panel. If defined inside the <config> element, it will be applied to all HTML pages of the application.

Usage

<restrict 
     authentication = "basic"
     (allow*)
/>
  • authentication: (optional). If set to "basic" then the Basic Access Authentication method will be used.

Example

<app>
   ...

   <config>
      <restrict authentication="basic"> 
         <allow privilege="ADMIN" />
         <user name="nick" password="123" privileges="ADMIN" /> 
      </restrict> 
   </config>
 
   <enumset name="Privileges" privileges="privileges"> 
      <enum value="ADMIN">ADMIN</enum> 
      <enum value="ANONYMOUS">ANONYMOUS</enum> 
   </enumset>
   
   ...
</app>
  • Adding a "SAVE" restriction to a entity:

A company can be saved only by users which have the "CS" privilege.

<entity label="Company" name="Company">
        <restrict>
            <allow action="SAVE" privilege="CS"/>
            <allow action="READ" privilege="ANONYMOUS"/>
            <allow action="LIST" privilege="ANONYMOUS"/>
            <allow action="REMOVE" privilege="ANONYMOUS"/>
        </restrict>
        ...
</entity>

The privileges enumset:

<enumset name="Privileges" privileges="privileges">
        <enum value="CS">companySave</enum>
        <enum value="CR">companyRead</enum>
        <enum value="CL">companyList</enum>
        <enum value="CRR">companyRemove</enum>
        <enum value="US">userSave</enum>
        <enum value="UR">userRead</enum>
        <enum value="UL">userList</enum>
        <enum value="URR">userRemove</enum>
</enumset>

See also

Personal tools