IRC logs for #farmOS, 2018-12-18 (GMT)

2018-12-17
2018-12-19
TimeNickMessage
[07:13:55]<amonteclicworld[>mstenta: is there a way of editing the API of Farm OS or adding an extension
[07:22:37]<mstenta[m]>Yes there's a lot of flexibility for altering and adding things via Drupal modules
[07:22:45]<mstenta[m]>What do you want to do?
[07:23:01]<amonteclicworld[>i want to add an account creation API extension
[07:23:33]<amonteclicworld[>so that users can create accounts through the API on our self Hosted FarmOS
[07:24:18]<mstenta[m]>Oh ok
[07:24:25]<mstenta[m]>That might be very easy actually
[07:24:49]<amonteclicworld[>Any direction you can give me
[07:24:56]<amonteclicworld[>You know its very big
[07:25:03]<mstenta[m]>Yeah take a look at this:
[07:26:31]<mstenta[m]>https://github.com/farmOS/farmOS/blob/7.x-1.x/modules/farm/farm_api/farm...
[07:27:04]<amonteclicworld[>Thanks
[07:27:07]<mstenta[m]>That file defines what entity types are accessible via the API to farm roles
[07:27:29]<mstenta[m]>the API itself is provided by this module:
[07:27:54]<mstenta[m]>https://www.drupal.org/project/restws
[07:28:24]<mstenta[m]>That module makes Drupal entities available via REST endpoints
[07:28:48]<mstenta[m]>"user" is an entity type in Drupal
[07:29:41]<mstenta[m]>So in other words: the user API already exists
[07:29:49]<mstenta[m]>You just need to grant permission to it
[07:30:10]<mstenta[m]>You can test it out yourself as user 1 (who has all permissions)
[07:30:30]<mstenta[m]>Try going to /user.json when you are logged in as user 1
[07:30:43]<mstenta[m]>You should see JSON listing of users
[07:31:07]<mstenta[m]>(note: I've never tried this myself, but that is theoretically how it should work)
[07:33:13]<mstenta[m]>So that file I linked to first is just the way in which farmOS grants permission to certain entity types in the API to the farmOS roles (manager, worker, and viewer)
[07:41:07]<amonteclicworld[>so i will be able to create new accounts ?
[07:49:16]<mstenta[m]>you should be able to, yes
[07:49:22]<mstenta[m]>but i haven't tested it
[07:49:41]<mstenta[m]>users are just another type of entity, as far as Drupal is concerned, so I think that will be possible
[07:50:05]<mstenta[m]>although maybe the API works a little differently with regard to setting a password and other security considerations
[07:50:44]<mstenta[m]>Drupal also has some configurations for how user accounts can be created
[07:50:53]<mstenta[m]>for example: "Administrators only" would mean that only admins can create new users
[07:51:08]<mstenta[m]>but there is a setting that allows anyone to sign up for a new account, so you would probably need to enable that
[07:51:49]<mstenta[m]>i'm not sure if the rest api allows anonymous users to create account, however... it may not
[07:52:37]<mstenta[m]>there are a lot of security and access-permission considerations around doing this - so you'll have to dig into it and experiment to see what's possible - please document what you find and share it with the rest of the community so we can all learn! :-)
[08:56:41]<amonteclicworld[>Alright i understand, thanks and let me dive in
[11:31:21]<paul121[m]>Hello everyone! Wanted to introduce myself quick, my name is Paul - I just graduated with a degree in Comp Sci. This week I've begun working on a market farm in Western WA. The farm is quite interested in incorporating technology for a few things. Right now we're focusing on crop tracking, as well as assigning tasks to workers through their phones. Tasks that are connected to crops, at their current stage, in their
[11:31:22]<paul121[m]>respective locations. Could save a lot of managerial time
[11:35:42]<paul121[m]>Following FarmOS I thought it might be a good fit - now seeing the API and offline app in development, exactly what we're looking for.
[11:35:42]<paul121[m]>For what we want I think we may need to add/modify some logging modules, and perhaps customize the offline app to our needs.
[11:35:43]<paul121[m]>Soon I will have quite a bit of time on my hands...would love to contribute what I can. @mstenta:matrix.org mentioned @jgaehring and Alex are working on this. What's the best way to get in touch?
[11:37:40]<paul121[m]>I've tried building the native app but ran into problems with docker - haven't had time to pursue further. Think I need to upgrade OS. Getting that far is well documented, though! Cheers..
[12:01:16]<mstenta[m]>paul121: Welcome!
[12:02:01]<mstenta[m]>Yea, jgaehring is leading the charge on the native app.
[12:02:02]<troym541[m]>amonte@clic.world: amonte@clic.world Regarding REST integration I found the following video very useful. https://www.youtube.com/watch?v=a2nHIWlCXSw&t=1854s You will need to get some type of REST Client like Postman to test it out.
[12:03:58]<mstenta[m]>paul121: The native app is currently going through some changes, as part of a sponsored sprint - I'd recommend checking out the issue queues in both of those repos to get a sense of things.
[12:04:08]<mstenta[m]>And feel free to add new issues/feature requests/questions etc there