byrokrat / giroapp

Command line app for managing autogiro donations.
GNU General Public License v3.0
4 stars 2 forks source link

Bug: add command does not check if donors.json is writable #106

Closed nonbinary closed 6 years ago

nonbinary commented 7 years ago

I've been testing the application with the changes that have been made during my absence, and found a bug that was a bit too tricky to pin down: giroapp statet that a donor had been added, but the donors.json file did not record it. The reason was simply that the user executing giroapp didn't have write permissions to the json file. This should probably be noticed by giroapp, and exceptions raised.

hanneskod commented 7 years ago

Hey welcome back! You have been missed =)

This is a good sugestion! Permissions should be checked in FilesystemConfigurator. Not sure how flysystem (the filesystem wrapper we are using) handles permissions though, so need to read on this before implementing. Should be simple...

olleolleolle commented 7 years ago

@hanneskod Is that what Flysystem calls 'Visibility'? (The "public"/"private" divide.)

The page on Local adapter had some notes on how it exposed public/private, which got me thinking.

But it's not exactly that, is it. The file can still be writable and private at the same time.

hanneskod commented 7 years ago

@olleolleolle what a pleasure to see you here! Yes visibility seems to be what flysystem has to offer. Not sure if it is good enough? Complicated..

However I am starting to think the problem lies deeper in the db layer. If writing fails then the db handle should probably throw some kind of error. Maybe that is a better way to get the desired error message..?