mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00

committed by
Sebastien Ros

parent
5033927da7
commit
9877d8488f
@@ -1,8 +1,12 @@
|
||||
@using Orchard.ContentManagement;
|
||||
@using Orchard.Core.Contents;
|
||||
@if (AuthorizedFor(Permissions.EditContent) && Model.ContentItem.Id > 0) {
|
||||
@{
|
||||
var contentItem = (ContentItem)Model.ContentItem;
|
||||
var authorizedFor = AuthorizedFor(Permissions.EditContent, contentItem);
|
||||
}
|
||||
@if (authorizedFor && Model.ContentItem.Id > 0) {
|
||||
<div class="content-control">
|
||||
<div class="manage-actions">@Html.ItemEditLinkWithReturnUrl(T("Edit").Text, (ContentItem)Model.ContentItem)</div>
|
||||
<div class="manage-actions">@Html.ItemEditLinkWithReturnUrl(T("Edit").Text, contentItem)</div>
|
||||
@Display(Model.Child)
|
||||
</div>
|
||||
}
|
||||
|
@@ -1,11 +1,15 @@
|
||||
@using Orchard.ContentManagement;
|
||||
@using Orchard.Widgets;
|
||||
@if (AuthorizedFor(Permissions.ManageWidgets)) {
|
||||
<div class="widget-control">
|
||||
<div class="manage-actions">@Html.ItemEditLinkWithReturnUrl(T("Edit").Text, (ContentItem)Model.ContentItem)</div>
|
||||
@Display(Model.Child)
|
||||
</div>
|
||||
}
|
||||
else {
|
||||
@Display(Model.Child)
|
||||
@{
|
||||
var contentItem = (ContentItem)Model.ContentItem;
|
||||
if (AuthorizedFor(Permissions.ManageWidgets, contentItem)) {
|
||||
<div class="widget-control">
|
||||
<div class="manage-actions">
|
||||
@Html.ItemEditLinkWithReturnUrl(T("Edit").Text, contentItem)</div>
|
||||
@Display(Model.Child)
|
||||
</div>
|
||||
}
|
||||
else {
|
||||
@Display(Model.Child)
|
||||
}
|
||||
}
|
@@ -174,6 +174,10 @@ namespace Orchard.Mvc.ViewEngines.Razor {
|
||||
return Authorizer.Authorize(permission);
|
||||
}
|
||||
|
||||
public bool AuthorizedFor(Permission permission, IContent content) {
|
||||
return Authorizer.Authorize(permission, content);
|
||||
}
|
||||
|
||||
public bool HasText(object thing) {
|
||||
return !string.IsNullOrWhiteSpace(Convert.ToString(thing));
|
||||
}
|
||||
|
Reference in New Issue
Block a user