Users editing own records

  • Views Views: 16,879
  • Last updated Last updated:

Navigation

         Form Article Plugin Tutorial
      Autofill form plugin
      Clone form plugin
      Comment form plugin
      Email form plugin
      EXIF form plugin
      FTP form plugin
      J2store form plugin
      Kunena form plugin
      Limit form plugin
      Logs form plugin
      Mailchimp form plugin
      Paginate form plugin
      Paypal form plugin
      PHP form plugin
      Pingdotfm form plugin
      Receipt form plugin
      Redirect form plugin
      REST form plugin
      Slack form plugin (+)
      SMS form plugin
      Twitter form plugin
      Upsert form plugin
      VBforum form plugin
      Create a Search Form
      Accordion Form Groups
  • There are two main scenarios in which you may want to restrict access to a users own records - in Forms and in Lists.

    Forms​

    For Forms, there is a video on this concept available for subscribers at https://fabrikar.com/help/tutorials called 'Access Control'.

    The basic premise behind the concept is that in the menu item that links to the form you are adding the specification to only display the row in the table that has the user's id is the 'userid' column.

    You are therefore required to specify in menu link > Options:

    Row id: -1​
    Key: userid​
    To implement this, there is the additional step required of creating a 'user' element and adding it to your form so that the user's id is in fact automatically grabbed and added to the data that is submitted with the form.

    The video tutorial mentioned above makes this concept and its implementation clearer as it demonstrates its usage in a 'user profile' scenario.

    Lists​

    For Lists, access control, in the context of limiting the display of records to those who created them, is achieved by adding prefilters.

    This can be done in the backend by going to Lists > [click on your list title] > Data > Pre-filter or in the frontend by setting the prefilter in the fabrik list menu Options.

    There you can define the filters that are applied to your list before it is displayed.

    So for example, to restrict the contents of the list so that it only displays records added by the user, you would add the following pre-filters:

    WHERE name(raw) EQUALS {$my->id}, Type: Text, Apply To: Registered​
    OR​
    WHERE id NOT EQUAL TO 0, Type: Text, Apply To: Special​

    This last condition enables Super Users to be able to administer and view all records.

    URL links to a form​

    Alternatively, you can create a URL link to the form:
    Code:
    index.php?option=com_fabrik&view=form&formid=X&rowid=-1&usekey=author

    Limit Form plugin​

    It is recommended to additionally use the limit form plugin (currently available only in github) to ensure that users can not bypass these Options by manually altering the URL.
Back
Top