public void Delete(string contentType, int id) { InitEavAndSerializer(); IEntity itm = _entitiesController.GetEntityOrThrowError(contentType, id, appId: App.AppId); PerformSecurityCheck(contentType, PermissionGrant.Delete, true, itm); _entitiesController.Delete(contentType, id); }
public void Delete(string contentType, Guid guid) { InitEavAndSerializer(); IEntity itm = _entitiesController.GetEntityOrThrowError(contentType, guid, App.AppId); //IEntity itm = App.Data.Out["Default"].LightList // pre-fetch for security and content-type check // .FirstOrDefault(e => e.EntityGuid == guid); contentType = Delete_SharedCode(contentType, itm); _entitiesController.Delete(contentType, guid); }
public Dictionary <string, object> Create(string contentType, int id, Dictionary <string, object> newContentItem) { InitEavAndSerializer(); // Now check standard create-permissions // Check that this ID is actually of this content-type, // this throws an error if it's not the correct type IEntity itm = _entitiesController.GetEntityOrThrowError(contentType, id, appId: App.AppId); PerformSecurityCheck(contentType, PermissionGrant.Update, true, itm); // Convert to case-insensitive dictionary just to be safe! newContentItem = new Dictionary <string, object>(newContentItem, StringComparer.OrdinalIgnoreCase); // Now create the cleaned up import-dictionary so we can create a new entity var cleanedNewItem = CreateEntityDictionary(contentType, newContentItem); // Get user name/id when creating, would be important if one day checking for author var x = Dnn.User.UserID; var userName = (x == -1) ? "Anonymous" : "dnn:id=" + x; // try to create App.Data.Update(id, cleanedNewItem, userName); // full version, with "who did it" for the log entry // Todo: try to return the newly created object return(_entitiesController.Serializer.Prepare(App.Data.List[id])); }
public Dictionary <string, object> GetOne(string contentType, int id, string appPath = null) => GetAndSerializeOneAfterSecurityChecks(contentType, appId => _entitiesController.GetEntityOrThrowError(contentType, id /*, appId*/), appPath);