Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permissions for edit applied from the page permissions. #1303

Merged
merged 3 commits into from
Apr 30, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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