cancel
Showing results for 
Search instead for 
Did you mean: 

How to make a checkbox active based on a user's authorisation?

Former Member
0 Kudos

Hi everyone.

I have a requirement for a Web Dynpro application I've created where a user with a certain authorisation can tick a checkbox to make all the rest of my fields read-only.

I should have no problem with the read-only part based on the value of the checkbox, but the issue I would like help with is how to make the checkbox only enabled for certain user groups.

I.E. I would like the checkbox to either not show or not be enabled unless the user belongs to authorisation group 'XXX'.

Is this possible?

If anyone could point me in the right direction it would be much appreciated.

Thanks

Kieran

Edited by: Kieran Ryan on May 10, 2011 6:23 AM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

Create an attribute of type WDY_BOOLEAN say ENABLE ,and bind enable property of check box.

Check the authorization in WDDOINIT method

i) If user is authorized set ENABLE with value "ABAP_TRUE"

ii) If user is NOT authorized set ENABLE with value "ABAP_FALSE"

OR

Create one attribute of type WDUI_VISIBILITY bind to visible property of ROOTUIELEMENTCONTAINER.

So based on login user show veiw, otherwise through some warning or error messange.

Hope it helps.

Cheers,

Kris.

Answers (1)

Answers (1)

Former Member
0 Kudos

HI,

You can bind the enabled property of the check box to a context attribute of type WDY_BOOLEAN.

WDY_BOOLEAN has values as follows,

X-true.

' '-false.

Then set this context attribute as required based on the auth group.

This would disable the checkbox.

However if you want to completely hide the checkbox, then bind the visible property of the checkbox to a context attribute of type

WDUI_VISIBILITY

WDUI_VISIBILITY has values as follows,

01- none.

02- visible.

Thanks,

Aditya.