Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

files_container_add_from_raw() failing with 'Access Denied' #37

Open
theWebalyst opened this issue Oct 29, 2019 · 2 comments

Comments

@theWebalyst
Copy link

@theWebalyst theWebalyst commented Oct 29, 2019

Using SB 15.1 I'm able to use the safe_files_xxx APIs to obtain the contents of files and folders, but after authorising the app I can't add a file. Testing with SB 15.2 is not possible as the site does not load at all (see maidsafe/safe_browser#1061).

     let filesContainer_get = this.safeJs.safeApi.files_container_get('safe://' + nrsName);
      console.log('files_container_get(safe://nrsName): ', JSON.stringify(filesContainer_get))
      
      let filesContainer_get2 = this.safeJs.safeApi.files_container_get(docUri);
      console.log('files_container_get(docUri): ', JSON.stringify(filesContainer_get2))
      
      let filesContainerData = this.safeJs.safeApi.files_container_add_from_raw(body, docUri, false, false, false);
      console.log('filesContainerData: ', JSON.stringify(filesContainerData))

The above code is fine until the call to files_container_add_from_raw() which gives the following error:

safenetworkjs:ldp Unable to create file 'safe://dublin-core/test3.txt' : Error: internal error in Neon module: Failed to add file form raw bytes to FilesContainer: NetDataError("Failed to PUT Published ImmutableData: CoreError(Access denied - CoreError::DataError -> AccessDenied)")

I wondered if I wasn't requesting the correct permissions but AFAIK there are no parameters for this currently and I'm seeing the same permission request as for safe auth in the authenticator UI:

The following application authorisation request was received:
+----------------------------------------------+-------------------+--------+------------------------+
| Id                                           | Name              | Vendor | Permissions requested  |
+----------------------------------------------+-------------------+--------+------------------------+
| https://github.com/otto-aa/solid-filemanager | solid-filemanager | A_A    | Own container: false   |
|                                              |                   |        | Default containers: {} |
+----------------------------------------------+-------------------+--------+------------------------+
Allow authorisation? [y/N]: y
Authorisation will be allowed...
Authorisation response sent

I'm not sure if this is a bug or if I'm doing something wrong.

Environment

Ubuntu 19.04

@theWebalyst

This comment has been minimized.

Copy link
Author

@theWebalyst theWebalyst commented Oct 30, 2019

A little extra info, here's the code I'm using to authorise:

      logApi('requesting auth of App...')
      let authUri = safe.auth_app(appInfo.id, appInfo.name, appInfo.vendor)
      logApi('...authUri obtained: ', authUri)
      logApi("connecting to SAFE Network...")

      safe.connect(appInfo.id, authUri)
      logApi('...connected SUCCESS')
@bochaco

This comment has been minimized.

Copy link
Member

@bochaco bochaco commented Nov 5, 2019

@theWebalyst you won't be able to mutate a FilesContainer using a second application, you can only do it with the application which created the FilesContainer, that's usually the case of those access denied errors. We still need to expose on APIs permissions for sharing content among apps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.