×
Please submit new Bug Reports on GitHub: github.com/Jensen-Technologies/component-creator-issues/issues
Login user can view other record which is not created by the same user
Lee Chen
Nieuw lid
Posts: 1
3 jaren 11 maanden geleden #9811
door Lee Chen
Login user can view other record which is not created by the same user werd gestart door Lee Chen
Hi everyone
I am wondering whether anyone has same problem as mine. The code below suppose if the user is Super User or login user id matches record created_by user id. However, if I changed the table id etc from 9 to 8 on the link /index.php/en/component/orders/order/9 to /index.php/en/component/orders/order/8 , where record 8 is not created by login user and still be able to view the record details.
if(empty($result) || $this->isAdminOrSuperUser() || $table->created_by == JFactory::getUser()->id){
}
any ideas?
many thanks.
I am wondering whether anyone has same problem as mine. The code below suppose if the user is Super User or login user id matches record created_by user id. However, if I changed the table id etc from 9 to 8 on the link /index.php/en/component/orders/order/9 to /index.php/en/component/orders/order/8 , where record 8 is not created by login user and still be able to view the record details.
if(empty($result) || $this->isAdminOrSuperUser() || $table->created_by == JFactory::getUser()->id){
}
any ideas?
many thanks.
Gelieve Inloggen of een account aanmaken om deel te nemen aan het gesprek.
Glenn Arkell
Nieuw lid
Posts: 7
3 jaren 10 maanden geleden #9814
door Glenn Arkell
Beantwoord door Glenn Arkell in topic Login user can view other record which is not created by the same user
Hi Lee,
You possibly have already solved this but just in case . . .
In the site/views/order/view.html.php file you can add an extra check here before the $this->_prepareDocument(); such as
if ((isset($this->item->created_by) && $this->item->created_by != $user->id) || $this->isAdminOrSuperUser()){
throw new Exception(Text::_('JERROR_ALERTNOAUTHOR'));
}
Hope this helps. Cheers.
Glenn
You possibly have already solved this but just in case . . .
In the site/views/order/view.html.php file you can add an extra check here before the $this->_prepareDocument(); such as
if ((isset($this->item->created_by) && $this->item->created_by != $user->id) || $this->isAdminOrSuperUser()){
throw new Exception(Text::_('JERROR_ALERTNOAUTHOR'));
}
Hope this helps. Cheers.
Glenn
Gelieve Inloggen of een account aanmaken om deel te nemen aan het gesprek.
Tijd voor maken pagina: 0.049 seconden