Skip to content

Commit

Permalink
Merge pull request #1303 from leigh-pointer/AddModulePermissions
Browse files Browse the repository at this point in the history
Permissions for edit applied from the page permissions.
  • Loading branch information
sbwalker authored Apr 30, 2021
2 parents b710ac8 + 2be48e9 commit d1abbde
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Oqtane.Client/Themes/Controls/Theme/ControlPanel.razor
Original file line number Diff line number Diff line change
Expand Up @@ -369,10 +369,12 @@
module.PageId = PageState.Page.PageId;
module.ModuleDefinitionName = ModuleDefinitionName;
module.AllPages = false;

// set module view permissions to page edit permissions
List<PermissionString> permissions = UserSecurity.GetPermissionStrings(PageState.Page.Permissions);
permissions.Remove(permissions.Find(p => p.PermissionName == PermissionNames.View));
List<string> editpermissions = permissions.Find(p => p.PermissionName == PermissionNames.Edit).Permissions.Split(";").ToList();
permissions.Add(new PermissionString { PermissionName = PermissionNames.View, Permissions = string.Join(";", editpermissions.ToArray()) });
permissions.Find(p => p.PermissionName == PermissionNames.View).Permissions = permissions.Find(p => p.PermissionName == PermissionNames.Edit).Permissions;
module.Permissions = UserSecurity.SetPermissionStrings(permissions);

module = await ModuleService.AddModuleAsync(module);
ModuleId = module.ModuleId.ToString();
}
Expand Down

0 comments on commit d1abbde

Please sign in to comment.