protected ArribaApplication(DatabaseFactory factory, ClaimsAuthenticationService claimsAuth) { this.EventSource = EventPublisher.CreateEventSource(this.GetType().Name); this.Database = factory.GetDatabase(); _claimsAuth = claimsAuth; // Cache correctors which aren't request specific // Cache the People table so that it isn't reloaded for every request. // TODO: Need to make configurable by table. _correctors = new ComposedCorrector(new TodayCorrector(), new UserAliasCorrector(this.Database["People"])); }
public ArribaImportApplication(DatabaseFactory f, ClaimsAuthenticationService auth) : base(f, auth) { // POST /table/foo?type=csv -- Import CSV data this.Post(new RouteSpecification("/table/:tableName", new UrlParameter("type", "csv")), this.ValidateWriteAccess, this.CsvAppend); // POST /table/foo?type=block -- Import as DataBlock format this.PostAsync(new RouteSpecification("/table/:tableName", new UrlParameter("type", "block")), this.ValidateWriteAccessAsync, this.DataBlockAppendAsync); // POST /table/foo?type=json -- Post many objects this.PostAsync(new RouteSpecification("/table/:tableName", new UrlParameter("type", "json")), this.ValidateWriteAccessAsync, this.JSONArrayAppendAsync); }
public ArribaManagement(DatabaseFactory f, ClaimsAuthenticationService auth) : base(f, auth) { // GET - return tables in Database this.Get("", this.GetTables); this.Get("/allBasics", this.GetAllBasics); this.Get("/unloadAll", this.ValidateCreateAccess, this.UnloadAll); // GET /table/foo - Get table information this.Get("/table/:tableName", this.ValidateReadAccess, this.GetTableInformation); // POST /table with create table payload (Must be Writer/Owner in security directly in DiskCache folder, or identity running service) this.PostAsync("/table", this.ValidateCreateAccessAsync, this.ValidateBodyAsync, this.CreateNew); // POST /table/foo/addcolumns this.PostAsync("/table/:tableName/addcolumns", this.ValidateWriteAccessAsync, this.AddColumns); // GET /table/foo/save -- TODO: This is not ideal, think of a better pattern this.Get("/table/:tableName/save", this.ValidateWriteAccess, this.Save); // Unload/Reload this.Get("/table/:tableName/unload", this.ValidateWriteAccess, this.UnloadTable); this.Get("/table/:tableName/reload", this.ValidateWriteAccess, this.Reload); // DELETE /table/foo this.Delete("/table/:tableName", this.ValidateOwnerAccess, this.Drop); this.Get("/table/:tableName/delete", this.ValidateOwnerAccess, this.Drop); // POST /table/foo?action=delete this.Get(new RouteSpecification("/table/:tableName", new UrlParameter("action", "delete")), this.ValidateWriteAccess, this.DeleteRows); this.Post(new RouteSpecification("/table/:tableName", new UrlParameter("action", "delete")), this.ValidateWriteAccess, this.DeleteRows); // POST /table/foo/permissions/user - add permissions this.PostAsync("/table/:tableName/permissions/:scope", this.ValidateOwnerAccessAsync, this.ValidateBodyAsync, this.Grant); // DELETE /table/foo/permissions/user - remove permissions from table this.DeleteAsync("/table/:tableName/permissions/:scope", this.ValidateOwnerAccessAsync, this.ValidateBodyAsync, this.Revoke); // NOTE: _SPECIAL_ permission for localhost users, will override current auth to always be valid. // this enables tables recovery from local machine for matching user as the process. // GET /table/foo/permissions this.Get("/table/:tableName/permissions", (c, r) => this.ValidateTableAccess(c, r, PermissionScope.Reader, overrideLocalHostSameUser: true), this.GetTablePermissions); // POST /table/foo/permissions this.PostAsync("/table/:tableName/permissions", async(c, r) => await this.ValidateTableAccessAsync(c, r, PermissionScope.Owner, overrideLocalHostSameUser: true), this.SetTablePermissions); }
public ArribaQueryApplication(DatabaseFactory f, ClaimsAuthenticationService auth) : base(f, auth) { // /table/foo?type=select this.GetAsync(new RouteSpecification("/table/:tableName", new UrlParameter("action", "select")), this.ValidateReadAccessAsync, this.Select); this.PostAsync(new RouteSpecification("/table/:tableName", new UrlParameter("action", "select")), this.ValidateReadAccessAsync, this.Select); // /table/foo?type=distinct this.GetAsync(new RouteSpecification("/table/:tableName", new UrlParameter("action", "distinct")), this.ValidateReadAccessAsync, this.Distinct); this.PostAsync(new RouteSpecification("/table/:tableName", new UrlParameter("action", "distinct")), this.ValidateReadAccessAsync, this.Distinct); // /table/foo?type=aggregate this.GetAsync(new RouteSpecification("/table/:tableName", new UrlParameter("action", "aggregate")), this.ValidateReadAccessAsync, this.Aggregate); this.PostAsync(new RouteSpecification("/table/:tableName", new UrlParameter("action", "aggregate")), this.ValidateReadAccessAsync, this.Aggregate); this.GetAsync(new RouteSpecification("/allCount"), this.AllCount); this.GetAsync(new RouteSpecification("/suggest"), this.Suggest); }
public InspectApplication(DatabaseFactory f, ClaimsAuthenticationService auth) : base(f, auth) { this.Get("/inspect/memory", this.Memory); this.Get("/inspect/machine", this.Machine); }