Reputation:
My roles are something like SEND_SMS_100
, SEND_SMS_200
or more in general SEND_SMS_X
where X
is an integer. It's the maximum number of small text message that an user can send over a month. An user should have at max one of this role. I'm looking for:
ensure SEND_SMS_X
is grantedX
integerAFAIK this will not support regular expression based search:
$this->get('security.context')->isGranted($roleName);
Upvotes: 0
Views: 1429
Reputation: 15082
I think this is bad design - this shouldn't be something that is controlled by roles.
You should probably have a $smsPerMonth property on your user entity so you can call getSmsPerMonth() instead of using many different roles to figure out how many SMS messages a user can send.
Upvotes: 6