Check if acls is populated before doing foreach

This commit is contained in:
Ramon Gutierrez 2018-01-12 03:14:35 +08:00
parent d8e8b94119
commit b198848a47

View file

@ -159,10 +159,14 @@ class RoleController extends BaseController
// acl attributes // acl attributes
$acl_attribs = $req->request->get('acl'); $acl_attribs = $req->request->get('acl');
if (!empty($acl_attribs))
{
foreach ($acl_attribs as $acl_key) foreach ($acl_attribs as $acl_key)
{ {
$row->addACLAccess($acl_key); $row->addACLAccess($acl_key);
} }
}
// validate // validate
$errors = $validator->validate($row); $errors = $validator->validate($row);
@ -240,11 +244,15 @@ class RoleController extends BaseController
// then add // then add
$acl_attribs = $req->request->get('acl'); $acl_attribs = $req->request->get('acl');
if (!empty($acl_attribs))
{
foreach ($acl_attribs as $acl_key) foreach ($acl_attribs as $acl_key)
{ {
$row->addACLAccess($acl_key); $row->addACLAccess($acl_key);
} }
} }
}
// validate // validate
$errors = $validator->validate($row); $errors = $validator->validate($row);