public bool Create([FromUri] int appId, [FromUri] string path, [FromBody] ContentHelper content, bool global = false) { Log.Add($"create a#{appId}, path:{path}, global:{global}, cont-length:{content.Content?.Length}"); path = path.Replace("/", "\\"); var thisApp = GetApp.LightWithoutData(new DnnTenant(PortalSettings.Current), appId, Log); if (content.Content == null) { content.Content = ""; } path = SanitizePathAndContent(path, content); var isAdmin = UserInfo.IsInRole(PortalSettings.AdministratorRoleName); var assetEditor = new AssetEditor(thisApp, path, UserInfo.IsSuperUser, isAdmin, global, Log); assetEditor.EnsureUserMayEditAssetOrThrow(path); return(assetEditor.Create(content.Content)); }
public bool Create(int appId, string path, FileContentsDto content, bool global = false) { Log.Add($"create a#{appId}, path:{path}, global:{global}, cont-length:{content.Content?.Length}"); path = path.Replace("/", "\\"); var thisApp = Factory.Resolve <Apps.App>().InitNoData(new AppIdentity(Eav.Apps.App.AutoLookupZone, appId), Log); if (content.Content == null) { content.Content = ""; } path = SanitizePathAndContent(path, content); var isAdmin = _user.IsAdmin; // UserInfo.IsInRole(PortalSettings.AdministratorRoleName); var assetEditor = new AssetEditor(thisApp, path, _user.IsSuperUser, isAdmin, global, Log); assetEditor.EnsureUserMayEditAssetOrThrow(path); return(assetEditor.Create(content.Content)); }