You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by O....@sh.cvut.cz on 2003/12/03 00:46:35 UTC
Logicsheet as condition
Hi all,
I'm making a little project in cocoon and I have been cornered now (nothing
unusal :)). I need to implement
a permission control of user's actions (it means, that for example some users
can create something, another users can just read somehing etc.). All is ok,
but I don't know, how to
check user's permissions in XSP. My idea is to write something as:
if (<permission:check name="user_can_write"/> == true) {
... then do something, what are you allowed to (some XSP, calling another
logicsheets etc.)...
}
or something like that:
<permission:check name="user_can_write">
... then do anything, what are you able to...
</permission:check>
The namespace "permission" is defined by a logicsheet, for example
template "check" will look into SQL databaese, if the appropriate user has
appropriate permission "user_can_write".
I think, that it is relatively usual stuff and many of you have to write it
almost every day... But when I tried to make it, following problems encountered:
In the first case is a problem, that if template <permission:check> looks into
db thru ESQL, it creates tons of java code, so it is no possible to compare
with value as a normal variable, of course.
In the second example I solve a problem, how to copy the inner content of
template without changes to be consequently correctly evaluate by another
logicsheets (my own other logicsheets, xsp logicsheet etc.) and virtual machine.
Another possibility is to write a pure java class, it will look into db and
will be return corresponding information. But how to use a connection pool of
cocoon (and if possible without settings of concrete connection parameters,
that are stored in the cocoon configuration file)? Don't you know a link to
concrete examples? In user docs are just very general and non-concrete
informations.
What am I doing wrong, please? Or do you have another idea, how to solve my
problem or some existing solution? Thanks a lot!
osup
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org