Updating Permissions via code not changing "Effective"

Topics: Writing modules
Dec 3, 2014 at 6:31 PM
In a custom application I'm working on, I'm changing permissions for the Anonymous role via code. The code I'm using is derived from the Orchard.Roles module and works to change the "Allow" permission for the role, but the "Effective" permission doesn't seem to get updated. If I then go into the UI and click "Save" on the role, the "Effective" permissions are updated.

Is there something I can do via code to affect both the "Allow" AND "Effective" permissions? I would have thought updating the role would affect both. Here's the code:
var anonymousRole = roleService.GetRoleByName("Anonymous");
List<string> anonymousPermissions = roleService.GetPermissionsForRoleByName("Anonymous").ToList();

if (privacyLevel == "medium" || privacyLevel == "high") {
else {

roleService.UpdateRole(anonymousRole.Id, anonymousRole.Name, anonymousPermissions);
Any suggestions on what I might be doing wrong? Thanks.