Page 1 of 1

Simplest way to restrict CR payment options

PostPosted: Fri Jun 14, 2019 4:10 pm
by pricerc
Specifically, period type and payment type.

I want to limit them to EFT and Monthly.

I can set them in plugin code, but I'd also like to disable the form controls so that people can't edit them.

I know I can disable/hide them using permissions, but then I need to set said permissions to all the groups on the system. Is there an easy way of doing that, that I haven't found yet?

I'm sure the same question will crop up for a different module, but this is the one I'm faced with today :)

Re: Simplest way to restrict CR payment options  Topic is solved

PostPosted: Fri Jun 14, 2019 6:47 pm
by Mike.Sheen
There's an old plugin in the sample forum which does some permission interception - Permission Override.

It hooks into the GettingAbstractPermission event but what you'd want is the GettingWritePermission event. Just add a handler to that in the Setup method of the FormPlugin class (make sure you add your form to the forms tab of the plugin) and inspect the ClassName and ControlName to return a modified access level.

Or you could just do a once-off SQL insert into the SY_UserGroupPermissions table for an initial setting of existing user groups, and also have a plugin set the permission whenever a new user group is created.

The first suggestion is easier - the only downside is it's introducing "magic" behaviour which if forgotten about will probably drive someone nuts a few years down the track.