mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-12-21 19:27:11 +08:00
Prevent MediaLibrary popup without permissions
If the user doesn't have ManageMedia permissions, the markdown editor will use a specific image editor.
This commit is contained in:
@@ -25,6 +25,7 @@
|
|||||||
<IISExpressAnonymousAuthentication />
|
<IISExpressAnonymousAuthentication />
|
||||||
<IISExpressWindowsAuthentication />
|
<IISExpressWindowsAuthentication />
|
||||||
<IISExpressUseClassicPipelineMode />
|
<IISExpressUseClassicPipelineMode />
|
||||||
|
<UseGlobalApplicationHostFile />
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
@@ -71,6 +72,10 @@
|
|||||||
<Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>
|
<Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>
|
||||||
<Name>Orchard.Core</Name>
|
<Name>Orchard.Core</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\Orchard.MediaLibrary\Orchard.MediaLibrary.csproj">
|
||||||
|
<Project>{73a7688a-5bd3-4f7e-adfa-ce36c5a10e3b}</Project>
|
||||||
|
<Name>Orchard.MediaLibrary</Name>
|
||||||
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="Content\Admin\Images\grippie.png" />
|
<Content Include="Content\Admin\Images\grippie.png" />
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
handler: function() { window.open("http://daringfireball.net/projects/markdown/syntax"); }
|
handler: function() { window.open("http://daringfireball.net/projects/markdown/syntax"); }
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (Boolean($(this).data("manage-media"))) {
|
||||||
editor.hooks.set("insertImageDialog", function (callback) {
|
editor.hooks.set("insertImageDialog", function (callback) {
|
||||||
// see if there's an image selected that they intend on editing
|
// see if there's an image selected that they intend on editing
|
||||||
var wmd = $('#wmd-input' + idPostfix);
|
var wmd = $('#wmd-input' + idPostfix);
|
||||||
@@ -69,6 +70,7 @@
|
|||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
editor.run();
|
editor.run();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -21,7 +21,8 @@
|
|||||||
{"id", "wmd-input" + "-" + idPostfix},
|
{"id", "wmd-input" + "-" + idPostfix},
|
||||||
{"class", "wmd-input"},
|
{"class", "wmd-input"},
|
||||||
{"data-mediapicker-uploadpath", Model.AddMediaPath},
|
{"data-mediapicker-uploadpath", Model.AddMediaPath},
|
||||||
{"data-mediapicker-title", T("Insert/Update Media")}
|
{"data-mediapicker-title", T("Insert/Update Media")},
|
||||||
|
{"data-manage-media", AuthorizedFor(Orchard.MediaLibrary.Permissions.ManageMediaContent) ? "true" : "false" }
|
||||||
};
|
};
|
||||||
|
|
||||||
// The markdown editor itself doesn't seem to (yet) support autofocus, but we'll set it on the textarea nonetheless.
|
// The markdown editor itself doesn't seem to (yet) support autofocus, but we'll set it on the textarea nonetheless.
|
||||||
|
|||||||
Reference in New Issue
Block a user