Data displayed by User only

Permalink Browser Info Environment
I am trying to setup a system where the User can enter data by a form and then view and edit only their own data/records that they have entered. All other users data is hidden from them. Is that possible and simple to set up? Of course Admins can see all data/records too.

Type: Discussion
Status: New
susrosario
View Replies:
TNTdesign replied on at Permalink Reply
TNTdesign
I know this was posted almost a year ago but I would like to know how to do this as well. Owners can only view their records but administrators can view all records. Possible?
TNTdesign replied on at Permalink Reply
TNTdesign
This is how I accomplished this:

First, edit the data display block so that the check box that says "Limit to records owned by user?" is checked.

Then in the block controller for data display I changed this:

if($this->showOwnedRecords) {
               $asl->requireOwnership();
               $fullasl->requireOwnership();
            }


to this:

if($this->showOwnedRecords) {
               $u = new User(); //gets current user object
               $g = Group::getByName("Administrators"); 
               if($u->inGroup($g)) {
               } else {
                  $asl->requireOwnership();
                  $fullasl->requireOwnership();
               }
            }


So now, only record owners can view their records but the above addition to the block controller adds an exception for users that are in the "Administrators" group.

concrete5 Environment Information

Browser User-Agent String

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.