Cameron schreef:
Hi guys, this is pretty pie in the sky, but I was wondering if anyone
had seen it done / had a good trick for it.
What I'd like to do is come up with a really clean way of controlling
which users can see which form fields. Example being a "role" field in
the "user" form - admins can set the user's role, but regular users
cannot. I know that I can wrap the odd if ($acl->isAllowed($params))
call around the element in my form init, but it seems to me that it'd
be really nice to be able to mark form elements as being a certain
resource name and then apply the permissions tools in exactly the same
way as an action plugin does, without explicitly defining the code,
just setting up the ACL lists. It's like we need a form helper or
something... It seems to me that the fewer inline ACL checks we have
to perform, the easier and safer our overall permission structure is
going to be. Anyone managed to do something like this?
Hi Cameron,
I didn't do it yet, but you can implement the resource infterface on any
custom element. So just make sure you use only custom elements where you
need this behavior and have those implement the resource interface and
let them check against the ACL themselves, using a decoractor for
example. But you would still have to write code...
-Bart