mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-27 04:19:04 +08:00
Fix issue: 16313 - Administrator can create two same roles
This commit is contained in:
@@ -77,6 +77,15 @@ namespace Orchard.Roles.Controllers {
|
||||
var viewModel = new RoleCreateViewModel();
|
||||
try {
|
||||
UpdateModel(viewModel);
|
||||
|
||||
//check if the role name already exists
|
||||
if (!_roleService.VerifyRoleUnicity(viewModel.Name))
|
||||
{
|
||||
Services.Notifier.Error(T("Creating Role failed: {0}", "Role with same name already exists"));
|
||||
|
||||
return RedirectToAction("Create");
|
||||
}
|
||||
|
||||
_roleService.CreateRole(viewModel.Name);
|
||||
foreach (string key in Request.Form.Keys) {
|
||||
if (key.StartsWith("Checkbox.") && Request.Form[key] == "true") {
|
||||
|
||||
Reference in New Issue
Block a user