Trying to Hide a Component using the Anotated Security

I have my role created and assigned to the logged in user… in that main menu I want to hide these 2 buttons.

@Override
@ScreenComponentAccess(screenId = “ambiente_PublicoMainMenu”, deny = {“btnNuevaSolicitud”, “btnMisSolicitudes”})
public ScreenComponentPermissionsContainer screenComponentPermissions() {
return super.screenComponentPermissions();
}

It doesent seem to work. Copuld anyone please help me?
thank you !

Hi.

Could you please provide more information about your problem? Which version of the platform do you use? Do you set up the role using Studio Role designer? If it is possible, could you share a small project to help us investigate the problem?

Regards,
Natalia

Hi, Thank you for your response.

Just create a new project add a extMain screen put a button btnHideMe

create this role
@Role(name = TestRole.NAME)
public class TestRole extends AnnotatedRoleDefinition {
public final static String NAME = “TestRole”;

@ScreenComponentAccess(screenId = "extMainScreen", deny = {"btnHideMe"})
@Override
public SpecificPermissionsContainer specificPermissions() {
    return super.specificPermissions();
}

}

create an account with minimal access and assign that role

log in and the button is still there… I dont want to see it for the test role.

How can I achieve this?hideComponentSecurity.zip (85.9 KB)

You use the wrong method and Studio shows you intention about it:
image

Here is the example of the right method:

@ScreenComponentAccess(screenId = "extMainScreen", deny = "testBtn")
@Override
public ScreenComponentPermissionsContainer screenComponentPermissions() {
   return super.screenComponentPermissions();
}

still doesent work.

Here is your demo project, everything works fine for me hideComponentSecurity.zip (86.0 KB)

Please check the Role settings.