Page 1 of 1

need help with userSecurityLevel-property

Posted: Tue Oct 13, 2009 10:55 am
by basti
Hi!

I´m an international student from Germany and currently at Massey Uni Auckland. I´m not an expert in programming and need some help (and hope to find it here).

My plan is to build a Login (for a System) and dependant on what user is logged in (e.g. a customer or the admin), the main menu-form should show different options. For that purpose I wanted to use the userSecurityLevel-property. Here is a small description:

"User Interface Security Support:
JADE includes facilities that enable you to tailor forms based on the security level of the user who
is currently signed on.

The app.userSecurityLevel is used to determine the security level of the user currently signed onto
the application. Valid values are in the range from 0 to Max_Integer with 0 being no security and
Max_Integer being the highest level.
The currentSession.userSecurityLevel property is used to determine the security level of the user
currently using a web enabled application."

My problem is now, that I cannot access the userSecurityLevel. I always get an error that the property is protected (I implemented the currentSession.userSecurityLevel:=... in the getAndValidateUser-method).

How can I access the userSecurityLevel-property or change it to public?

Is there maybe a better way to alter a form depenedant on what user is logged in?

Hope my description is not too confusing :) .

cheers & thanks!

Re: need help with userSecurityLevel-property

Posted: Tue Oct 13, 2009 11:17 am
by BeeJay
Your comment about using Global::getAndValidateUser is suggestive that you're possibly not developing a Web enabled application but rather a desktop application - especially given you also mention hiding menus on your main form.

If my assumption is correct, then you should be setting app.userSecurityLevel rather than the currentSession.userSecurityLevel. This property is public and you will therefore not get a compile error setting this value directly from Global::getAndValidateUser.

If my assumption is incorrect, then you should create a "setUserSecurityLevel" method on your subclass of RootSchemaSession and then use currentSession.setUserSecurityLevel( <value> ) to set the protected RootSchemaSession::userSecurityLevel to the desired <value>.

As to whether or not there is a better way of hiding menus, the Application::userSecurityLevel option is making an assumption that a user with level "nn" security has access to all options at level "nn" or below. This is not necessarily an accurate representation of real world requirements, so you'll find that a number of development teams have instead implemented their own security methodology to more discretely assign/deassign specific permissions in a more granular manner.

Cheers,
BeeJay.

Re: need help with userSecurityLevel-property

Posted: Wed Oct 14, 2009 12:32 pm
by basti
Thanks. It worked. And yes - it´s really not a good way to do it. I already found another solution.