You have to write some code.
The simplest solution is to check if the user has a particular role by looking into the authorities collection of the current authentication object as shown in the example here: Authentication :: Jmix Documentation
A more clean and extendable solution is to define a Specific policy in a resource role and test if the user has the permission to this resource using AccessManager. For example, if you define demo.myButton policy, you can use it as follows:
@Autowired
private Button myButton;
@Autowired
private AccessManager accessManager;
@Subscribe
public void onBeforeShow(BeforeShowEvent event) {
SpecificOperationAccessContext accessContext =
new SpecificOperationAccessContext("demo.myButton");
accessManager.applyRegisteredConstraints(accessContext);
if (!accessContext.isPermitted()) {
myButton.setEnabled(false);
}
}