Welcome, Guest
Username: Password: Remember me

TOPIC: Restricting Front End Viewing of Records

Restricting Front End Viewing of Records 22 Nov 2016 19:08 #14720

  • rholzler
  • rholzler's Avatar
  • Offline
  • Junior Member
  • Posts: 30
  • Thank you received: 1
  • Karma: 0
Assuming I want to have users login and see a list of items in their collection. Is there a way to build a front-end page that only lists the records/items assigned to a that specific user?
The administrator has disabled public write access.

Restricting Front End Viewing of Records 22 Nov 2016 19:41 #14721

  • vlemos
  • vlemos's Avatar
  • Online
  • Elite Member
  • Posts: 295
  • Thank you received: 41
  • Karma: 21
In a nutshell yes:
Create a field on the table such as created_by and use the author wizard to automate the process.

On the list page, use a filter to pull only the records created by the logged in user.

Warm regards
v
The administrator has disabled public write access.

Restricting Front End Viewing of Records 23 Nov 2016 08:17 #14724

  • organicwebs
  • organicwebs's Avatar
  • Offline
  • Premium Member
  • Chris
  • Posts: 133
  • Thank you received: 21
  • Karma: 4
Although filters are handy to search through data, using them for default views can be troublesome (I found). Depending on how the user is navigating, the filters are sometimes ignored (or forgotten).

If you want more control over the data displayed, fork the model function populateState() with this line...
if (!$acl->get('core.admin')) $this->setState('query.where', array("a.created_by = $userId"));  // Just show own records - unless you are the  admin
Just call me Chris :)
The administrator has disabled public write access.
The following user(s) said Thank You: admin
Time to create page: 0.100 seconds

Get Started