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, int id) { InitEavAndSerializer(); // don't allow type "any" on this if (contentType == "any") { throw new Exception("type any not allowed with id-only, requires guid"); } IEntity itm = App.Data.Out["Default"].List[id]; // pre-fetch for security checks contentType = Delete_SharedCode(contentType, itm); _entitiesController.Delete(contentType, id); }
public void Delete(string contentType, int id, [FromUri] string appPath = null) { Log.Add($"delete id:{id}, type:{contentType}, path:{appPath}"); // if app-path specified, use that app, otherwise use from context var appId = GetAppIdFromPathOrContext_AndInitEavAndSerializer(appPath); // don't allow type "any" on this if (contentType == "any") { throw new Exception("type any not allowed with id-only, requires guid"); } IEntity itm = _entitiesController.GetEntityOrThrowError(contentType, id); PerformSecurityCheck(appId, itm.Type.Name, Grants.Delete, appPath == null ? Dnn.Module : null, App, itm); _entitiesController.Delete(itm.Type.Name, id, appId); }
public void Delete(string contentType, int id, [FromUri] string appPath = null) { Log.Add($"delete id:{id}, type:{contentType}, path:{appPath}"); // if app-path specified, use that app, otherwise use from context var appId = GetAppIdFromPathOrContext_AndInitEavAndSerializer(appPath); // don't allow type "any" on this if (contentType == "any") { throw new Exception("type any not allowed with id-only, requires guid"); } IEntity itm = _entitiesController.GetEntityOrThrowError(contentType, id /*, appId*/); //var autoAllowAdmin = contentType != "any"; // only auto-allow-admin, if a type is clearly specified (protection from deleting other types) //Delete_SharedCode(itm, appPath == null, appId, autoAllowAdmin); PerformSecurityCheck(itm.Type.Name, PermissionGrant.Delete, true, itm, appPath == null, appId); _entitiesController.Delete(itm.Type.Name, id, appId); }
public void EntitiesDeletTest() { using (var repo = new RepositoryMock()) { Assert.AreEqual(0, repo.TimesCalled); var target = new EntitiesController(repo); target.Delete(2); Assert.AreEqual(1, repo.TimesCalled); } }
public void Delete(string contentType, int id) { InitEavAndSerializer(); PerformSecurityCheck(contentType, PermissionGrant.Delete, true); _entitiesController.Delete(contentType, id); }