Modifying ACL in Parse Server - acl

I'm trying to modify the ACL of an object without creating another one. I don't want the current ACL to be deleted or overwritten. Whenever I use object.setACL() it overwrites the current ACL.
Is there a way to save the modified the ACL without overwriting it?

You can get the existing ACL object by calling object.getACL(). From there you can edit/add more roles or users without overwriting the existing ones.
Once you've modified the existing ACL, you can then object.setACL(modifiedAcl) to save the modifications.

Related

uploading project with jsonfile

I just uploaded my last project to heroku and it includes in it a jsonfile that behave like database. You can add and delete data through the UI.
If I want to work on the project and push it again, and meanwhile the JSON file was modified (on the server), it won't be updated to the version in the development environment?
At first I thought that if I don't modify it manually, it won't be staged, but what if I do want to update it manually?
In that case I assume you need to clone, modify and push it again, but if meanwhile someone updated it his data will be deleted.
so maybe you should block the UI from updating the jsonfile while you modify it manually.
I got it wrong?
is there any way to do it better?

IPFS: Symbolic links in MFS

Is there a symlink equivalent for IPFS's Mutable File System? For example, if I have a file:
/source/file.txt
and I copy it another folder:
ipfs files cp /source/file.txt /reference/file.txt
the two files will refer to the same object. If I make a change to /source/file.txt the copy in /reference/file.txt will still point to the old version. Is there a good way to make it point to the current version of the file in /source/?
I could keep track of all the copies and update them whenever I change the original, but that doesn't sound fun. I could also store the string "/source/file.txt" in /reference/file.txt and manually dereference each time I want to access the file. Better, but still cumbersome. Are there any other options?
For the time being, there is no support for symnlinks in MFS: you need to track and update them manually in userland. Current MFS implementation uses immutable identifiers (CID) and each directory's CID is based on hashes of its children, so storing string in a file sounds like the most optimal way, as it does not trigger DAG recalculation every time you update the target file.

Totally new to Talend ESB

I'm completely brand new to Talend ESB (not so much Talend for data integration, but ESB totally.)
That being said, I'm trying to build a simple route that watches a specific file path and get the filename of any file dropped into it. Then it will pass that filename to the childjob (cTalendJob) and the child job will do something to the file.
I'm able to watch the directory, procure the filename itself and System.out.println the filename. but I can't seem to 'pass' it down to the child job. When it runs, the route goes into an endless loop.
Any help is GREATLY appreciated.
You must add a context parameter to your Talend job, and then pass the filename from the route to the job by assigning it to the parameter.
In my example I added a parameter named "Param" to my job. In the Context Param view of cTalendJob, click the + button and select it from the list of available parameters, and assign a value to it.
You can then do context.Param in your child job to use the filename.
I think you are making this more difficult than you need...
I don't think you need your cProcessor or cSetBody steps.
In your tRouteInput if you want the filename, then map "${header.CamelFileName}" to a field in your schema, and you will get the filename. Mapping "${in.body}" would give you the file contents, but if you don't need that you can just map the required heading. If your job would read the file as a whole, you could skip that step and just map the message body.
Also, check the default behaviour of the camel file component - it is intended to put the contents of the file into a message, moving the file to a .camel subdirectory once complete. If your job writes to the directory cFile is monitoring, it will keep running indefinitely, as it keeps finding a "new" file - you would want to write any updated files to a different directory, or a filename mask that isn't monitored by the cFile component.

Is it a good idea to manage database with csv files?

I'm working on a feature that imports users into a MySQL database.
The initial goal of this feature was to add new users from CSV files.
Gradually my client wants more of this tool. Indeed, if the CSV file contains a row with an already existed user, the data will be updated (the feature erases the old data with the new). So we implement it.
After that, he wants to update users (i.e. remove data, add data et cetera) but he already has a man/machine interface to do that.
I feel we're going in the wrong way.
What do you think about this ? Is it a good idea to manage database with csv files ?
I can see no problem using CSV to do that. You need to define a clear file format which specify object type and action, like for example :
<object type>;<action>;<value1>;<value2>;etc…
So you can have
user;add;Bob;Stone;fr
then
user;update;Bob;Stone;uk
then
user;del;Bob;Stone
etc…

Chrome app create and write to file

I am attempting to use chrome.apps for a program that needs to write multiple separate log files of data. The user then needs to be able to access these these log files outside of the app in their file system for post processing.
This will need to be done many times so minimum to no user interaction would be desired for file generation. While this is simple in any native program code, I've been finding this very difficult to do with chrome apps.
E.g. can I use chrome apps to create "log_file.txt" & "log_file2.txt" without user interaction?
Is there any way I can have the user just specify a directory then from my app, I would be able to create multiple files within that directory without user interaction?
I've tried to do this in code but I need "entry" handles for the chrome.filesystem. The "getEntry" method requires an "entry" so it seems impossible to create new "entry"s such that I can write to new files.
Any ideas would be appreciated!
Is there any way I can have the user just specify a directory then from my app, I would be able to create multiple files within that directory without user interaction?
Yes. You need to request a directory with
chrome.fileSystem.chooseEntry({type: "openDirectory"}, /*...*/);
As long as you have the permissions
{"fileSystem": ["write", "retainEntries", "directory"]}
you will be able to create files in that directory, and "retain" (save) the directory entry for later reuse without asking the user again. Creating the files once you have a DirectoryEntry should be similar to this.
But that minimum of interaction (asking for the folder initially) is required.