Fix issue: 16313 - Administrator can create two same roles

This commit is contained in:
rukshanperera
2011-02-03 13:28:44 +00:00
parent e47c582001
commit 86c11ada8e
3 changed files with 28 additions and 0 deletions

View File

@@ -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") {