Hi,
There is a workaround without having code using Ribbon workbench , inside ribbon workbench you can find there is a Display Rule called "MiscellaneousPrivilegeRule" where you can set some predefined Miscellaneous access by which you can show/hide the button, for example here I have a user having role "Sales Manager" roles which does not have any "Duplicate Detection" privilege.

I open Ribbon workbench with opportunity entity , customize the button and add a display rule for the "Won" button with following , I have set here "Duplicate Detection" privilege depth "Basic" which means user with minimum access level "Basic" on duplicate detection can see the "Won" button , dont forget to attach display rule with the command.

Now I have assigned the "Sales Manager" role to the user and I could not see the button won for the user.

You can bring back the button by simply modifying the security role and giving access to publish duplicate detection in the security role .
Please note this is workaround , and you have to use Miscellaneous Privilege which user not needed any circumstances in future.
Another way would be using "EntityPrivilegeRule" for which you need to show hide button based on another entity access. You can also use this .

I wrote a blog for you see here -
https://goutamdascrm.wordpress.com/2020/01/06/show-hide-ribbon-button-based-on-security-role-without-writing-code-in-dynamics-365-ce/
Hope this helps.