Commit Graph

69 Commits

Author SHA1 Message Date
Dane Everitt
de923bbb83 Fix server deletion logic, and clean up suspend/unsuspend operations 2017-04-17 20:16:05 -04:00
Dane Everitt
1a87943f07 Fix missing CommandRepository statement 2017-04-15 13:54:34 -04:00
Dane Everitt
7f1a97184b Un-butcher task system. 2017-04-15 13:52:43 -04:00
Dane Everitt
93d79994f8 Apply fixes from StyleCI (#372) 2017-04-09 19:16:39 -04:00
Dane Everitt
722fd614a1 Add new dynamic view for creating API keys 2017-04-09 18:59:54 -04:00
Dane Everitt
87c09a921b More defined naming scheme for config 2017-04-09 16:05:18 -04:00
Dane Everitt
de8bbcd098 Configuration for API pagination and includes on listing 2017-04-09 16:04:08 -04:00
Dane Everitt
69dfd380ad Finalize API routes 2017-04-09 15:53:53 -04:00
Dane Everitt
820d2bf172 Node and user API routes implemented.
More attempts at the logic for API permissions, most likely will need
continued tweaking in the future, but base is there.
2017-04-09 15:31:10 -04:00
Dane Everitt
f24b238e30 Base node route implementation 2017-04-09 13:52:31 -04:00
Dane Everitt
c492446513 Implement initial server and location API routes.
Also fixes a few exception handler issues causing incorrect HTTP status
codes on authorization errors.
2017-04-09 13:15:15 -04:00
Dane Everitt
4479d3bf19 Improved logic for handling permissions on API routes.
Still only partially implemented, however this method will allow the
inclusion of data that is granted with servers (such as viewing more
about the node, node location, allocations, etc) while still limiting
someone from doing `?include=node.servers` and listing all servers when
they don’t have list-servers as a permission.
2017-04-08 12:05:29 -04:00
Dane Everitt
db4df2bfa1 Push basis of new API key policy
Will need to revisit this another day when I’m fresh to figure out the
best method to do this.
2017-04-07 21:25:17 -04:00
Dane Everitt
51204b8d9d Add all of the potential transformers that might be needed for now. 2017-04-07 20:28:58 -04:00
Dane Everitt
65630bdcce Move API to use JSON:API standards and fractal serializer
Makes the data slightly more complex, but forces a standard and can
always be changed down the road simply by changing the default
serializer.
2017-04-02 16:51:56 -04:00
Dane Everitt
c071efd008 Finish API routes for users. 2017-04-02 15:52:53 -04:00
Dane Everitt
97773300ed Better middleware for routes, cleaned up API, removed old API calls
New API routes for Server allow specifying which fractal objects to
load into the request, thus making it possible to fine-tune what data
is returned.
2017-04-02 13:19:39 -04:00
Dane Everitt
ddb82ac3ca Add initial user server transformer for API. 2017-04-02 00:49:53 -04:00
Dane Everitt
87530cdc01 Initial moves to new API scheme.
Implements a better middleware for handling API authentication, as well
as cleaner route handling.
2017-04-02 00:11:52 -04:00
Dane Everitt
cbeecfe5e4 Implement front-end server searching 🍬 2017-04-01 13:14:49 -04:00
Dane Everitt
536865b22a Remove deletion queue for servers. Just immediately delete. 2017-03-31 22:12:31 -04:00
Dane Everitt
f0057353ad Apply fixes from StyleCI 2017-03-19 23:52:11 +00:00
Dane Everitt
0312c974f5 Update doc blocks for all app/ 2017-03-19 19:36:50 -04:00
Dane Everitt
5e27772fef Very rough go at getting API back into operational state.
Not spending a lot of time on this as its a pre-release and I have
plans to overhaul the API to actually work and be easy to maintain.
2017-03-19 13:20:33 -04:00
Dane Everitt
2e134b7a55 Set out some roach traps to catch all these 🐛 2017-02-16 13:56:28 -05:00
Dane Everitt
7c916ad38f Apply fixes from StyleCI (#294) 2017-02-12 15:10:39 -05:00
Dane Everitt
32a1dc17ed API model updates, as well as general model updates and code fixes. 2017-02-10 20:26:38 -05:00
Dane Everitt
02458c909d Improves server model and cleans up model code calls. 2017-02-05 19:19:46 -05:00
Dane Everitt
323f1d943f Completed model updates for Services 2017-02-05 17:58:17 -05:00
Dane Everitt
3114b7e52a Complete implementation of new Server model. 2017-02-02 19:41:38 -05:00
Dane Everitt
d4bcf0be59 Initial implementation of improved sever model and logic 2017-02-02 18:21:36 -05:00
Dane Everitt
7f51e5df62 API tweaks to return more relevant information on server listing 2017-02-02 16:24:08 -05:00
Dane Everitt
32c21baab0 Return packs associated with a service when viewing it on the API. 2017-02-02 16:01:18 -05:00
Dane Everitt
bf7b58470a Update copyright headers 2017-01-24 17:57:08 -05:00
Dane Everitt
e91362eee6 Update user controller 2017-01-12 15:40:24 -05:00
Dane Everitt
39731f99da Merge pull request #226 from hammerdawn/APICHANGE
Allow listing a user by both ID and email. Useful for checking if a u…
2017-01-02 22:00:45 -05:00
Emmet Young
3f5bf099ae Use DaneEveritt's shortened query call. 2017-01-03 13:40:35 +11:00
Emmet Young
b5d3417167 Allow listing a user by both ID and email. Useful for checking if a user exists by its email. 2016-12-29 22:56:45 +11:00
spaceemotion
a85ac87ae8 Refactor to use more laravel logic and improve compatibility with older PHP versions (#206)
* Fix @param namespaces for PHPDocs in ServerPolicy

* Reduce permission check duplication in ServerPolicy

This introduces a new checkPermission method to reduce code duplication when checking for permissions.

* Simplify logic to list accessible servers for the user

We can directly use the pluck function that laravel collections provide to simplify the logic.

* Fix pagination issue when databases/servers exceed 20

Laravels strips out the currently selected tab (or any GET query for that matter) by default when using pagination. the appends() methods helps with keeping that information.

* Refactor unnecessary array_merge calls

We can just append to the array instead of constantly merging a new copy.

* Fix accessing “API Access” on some versions of PHP

The “new” word is reserved and should not be used as a method name.

http://stackoverflow.com/questions/9575590/why-am-i-getting-an-unexpected-t-new-error-in-php

* Fix revoking API keys on older versions of php (5.6)

“string” was not a valid function argument type yet, so revoking keys results in an error on older installations.

* Fix issues with API due to methods named “list”

“list” is yet another reserved keyword in PHP and messes up older installations of PHP (5.6).
This renames all methods named “list” to “lists”. The API route names are left untouched (e.g. still called “api.admin.users.list”).

* Refactor and shorten some API logic

Used laravel collection methods where applicable to directly transform the values instead of converting back and forth.
This also removes some dead variables that were never used as well as getting rid of a n+1 problem in the Service API (loading service variables afterwards, not during the model creation).

* Return model save status in repositories where applicable

* Fix typo in ServicePolicy#powerStart

* Apply StyleCI corrections
2016-12-12 14:30:57 -05:00
Dane Everitt
c1fb0a665f Apply fixes from StyleCI 2016-12-07 22:46:38 +00:00
Emmet Young
f687fab9a2 API: ability to search for an allocation based on the assigned server id (#194) 2016-12-04 22:17:35 -05:00
Dane Everitt
2ac734d595 Update node config sent over API 2016-12-02 19:12:29 -05:00
Jakob
03c6f986d2 fix api /servers/{id}/build
remove unrelated error thrown every time
2016-11-30 12:26:23 +01:00
Dane Everitt
dfeed013ba Server API obey's the subuser permissions as well 2016-10-20 17:04:58 -04:00
Dane Everitt
125856d92f Support for server info and minor changes to API setup 2016-10-20 16:42:54 -04:00
Dane Everitt
5a03ce7e1a Add support for controlling server power from API. 2016-10-20 13:39:39 -04:00
Dane Everitt
745c735b32 Add initial basic API changes
New route is `/api/me`
2016-10-14 20:22:23 -04:00
Dane Everitt
84a4c8b7f4 API enhancements, return node config, return 200 not 201 2016-10-12 15:42:23 -04:00
Dane Everitt
06422b2055 fix up API route return 2016-10-07 14:26:50 -04:00
Dane Everitt
06756af994 add ?daemon=true option to API for servers 2016-10-06 23:56:32 -04:00