();
+ foreach (string key in Request.Form.Keys) {
+ if (key.StartsWith("Checkbox.") && Request.Form[key] == "true") {
+ string permissionName = key.Substring("Checkbox.".Length);
+ rolePermissions.Add(permissionName);
}
- _roleService.UpdateRole(viewModel.Id, viewModel.Name, rolePermissions);
}
- else if (!String.IsNullOrEmpty(HttpContext.Request.Form["submit.Delete"])) {
- _roleService.DeleteRole(viewModel.Id);
- }
- return RedirectToAction("Edit", new { viewModel.Id });
+ _roleService.UpdateRole(viewModel.Id, viewModel.Name, rolePermissions);
+
+ Services.Notifier.Information(T("Your Role has been saved."));
+ return RedirectToAction("Edit", new { id });
}
catch (Exception exception) {
Services.Notifier.Error(T("Editing Role failed: {0}", exception.Message));
- return RedirectToAction("Edit", viewModel.Id);
+ return RedirectToAction("Edit", id);
+ }
+ }
+
+ [HttpPost, ActionName("Edit")]
+ [FormValueRequired("submit.Delete")]
+ public ActionResult EditDeletePOST(int id) {
+ if (!Services.Authorizer.Authorize(Permissions.ManageRoles, T("Not authorized to manage roles")))
+ return new HttpUnauthorizedResult();
+
+ try {
+ _roleService.DeleteRole(id);
+
+ Services.Notifier.Information(T("Role was successfully deleted."));
+ return RedirectToAction("Index");
+ } catch (Exception exception) {
+ Services.Notifier.Error(T("Editing Role failed: {0}", exception.Message));
+ return RedirectToAction("Edit", id);
}
}
}
diff --git a/src/Orchard.Web/Modules/Orchard.Roles/Orchard.Roles.csproj b/src/Orchard.Web/Modules/Orchard.Roles/Orchard.Roles.csproj
index cd9fb5214..5276d0806 100644
--- a/src/Orchard.Web/Modules/Orchard.Roles/Orchard.Roles.csproj
+++ b/src/Orchard.Web/Modules/Orchard.Roles/Orchard.Roles.csproj
@@ -103,6 +103,10 @@
{2D1D92BB-4555-4CBE-8D0E-63563D6CE4C6}
Orchard.Framework
+
+ {9916839C-39FC-4CEB-A5AF-89CA7E87119F}
+ Orchard.Core
+
diff --git a/src/Orchard.Web/Modules/Orchard.Roles/Views/Admin/Index.cshtml b/src/Orchard.Web/Modules/Orchard.Roles/Views/Admin/Index.cshtml
index 16fc00388..44aa8971f 100644
--- a/src/Orchard.Web/Modules/Orchard.Roles/Views/Admin/Index.cshtml
+++ b/src/Orchard.Web/Modules/Orchard.Roles/Views/Admin/Index.cshtml
@@ -9,24 +9,24 @@
-
-
+
+
@Html.ActionLink(T("Add a role").ToString(), "Create", new { }, new { @class = "button primaryAction" })
-
}
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Orchard.Widgets/Controllers/AdminController.cs b/src/Orchard.Web/Modules/Orchard.Widgets/Controllers/AdminController.cs
index 5560ea0fc..2a7dd5851 100644
--- a/src/Orchard.Web/Modules/Orchard.Widgets/Controllers/AdminController.cs
+++ b/src/Orchard.Web/Modules/Orchard.Widgets/Controllers/AdminController.cs
@@ -44,9 +44,10 @@ namespace Orchard.Widgets.Controllers {
layers.First() :
layers.FirstOrDefault(layer => layer.Id == id);
- if (currentLayer == null) {
+ if (currentLayer == null &&
+ id != null) {
// Incorrect layer id passed
- Services.Notifier.Error(T("Layer not found: {1}", id));
+ Services.Notifier.Error(T("Layer not found: {0}", id));
return RedirectToAction("Index");
}
@@ -254,7 +255,7 @@ namespace Orchard.Widgets.Controllers {
try {
widgetPart = _widgetsService.GetWidget(id);
if (widgetPart == null) {
- Services.Notifier.Error(T("Widget not found: {1}", id));
+ Services.Notifier.Error(T("Widget not found: {0}", id));
return RedirectToAction("Index");
}