Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Contributor
Georgechr
Posts: 45
Registered: ‎06-28-2013
My Device: Z10
My Carrier: None
Accepted Solution

Cannot write to shared folder when in secure workspace

Hello,

 

I am working on an application which writes to a debug log file in the shared documents folder. I am using blackberry.io to get the path of the folder as follows 

fs.root.getFile(blackberry.io.shared + '/documents/debug.txt', {create: true}, this._handleFileRead, this._handleError);

 I make sure I 'unsandbox' first by going: blackberry.io.sandbox = false; as per the API's instructions.

 

When I deploy the application to the personal space it works fine. When I deploy the application through the BES10 to the work space then I get a NO_MODIFICATION_ALLOWED_ERR when trying to get/create the file..

 

Note: If I try to create the file in my sandbox it works ok in both spaces.

Please use plain text.
Contributor
Georgechr
Posts: 45
Registered: ‎06-28-2013
My Device: Z10
My Carrier: None

Re: Cannot write to shared folder when in secure workspace

Anyone has any idea on how to do this? Or if this is even possible? 

Please use plain text.
BlackBerry Development Advisor
anzor_b
Posts: 164
Registered: ‎09-24-2012
My Device: White BlackBerry 10
My Carrier: Bell

Re: Cannot write to shared folder when in secure workspace

Hi Georgechr,

 

The error message indicates your application does not have write access to the shared directory.

 

FYI, the Work Space shared folder is located here:

 

/accounts/1000-enterprise/shared

 

while the personal shared folder is located here:

 

/accounts/1000/shared

 

First, let's make sure blackberry.io.shared actually points at the work space shared folder. Please print (console.log()) its results and attach to your response.

 

An app which is installed in the work perimeter may store data in both work and personal spaces as long as the following IT policy is set to Allow on BES:

 

Security -> Work App Access to Personal Data

 

Regards,

 

A.

Please use plain text.
Contributor
Georgechr
Posts: 45
Registered: ‎06-28-2013
My Device: Z10
My Carrier: None

Re: Cannot write to shared folder when in secure workspace

Hello,

 

Thanks for your reply. I have checked the 2 paths and they look fine. Before posting here I also did try to work around it by navigating to the shared folder of the personal space i.e. blackberry.io.home + '/../../../../1000/shared. This didn't work either (same error). The 2 paths I get are

 - Home: /accounts/1000-enterprise/appdata/<app_id>/data (this is ok)

 - Shared: /accounts/1000-enterprise/appdata/<app_id>/data/../shared/

 

I have checked the IT policy setting you mentioned and it is set to Allowed by default.

Please use plain text.
Contributor
Georgechr
Posts: 45
Registered: ‎06-28-2013
My Device: Z10
My Carrier: None

Re: Cannot write to shared folder when in secure workspace

Also note that for the personal space I get the same paths (without the -enterprise bit) and logging works fine.

Please use plain text.
BlackBerry Development Advisor
anzor_b
Posts: 164
Registered: ‎09-24-2012
My Device: White BlackBerry 10
My Carrier: Bell

Re: Cannot write to shared folder when in secure workspace

Thanks Georgechr,

 

Can you provide the device OS version and BuildID from Settings > About > OS as well as the version of the WebWorks SDK you are using?

 

I will set up a test environment and attempt to reproduce on my end.

Please use plain text.
Contributor
Georgechr
Posts: 45
Registered: ‎06-28-2013
My Device: Z10
My Carrier: None

Re: Cannot write to shared folder when in secure workspace

sure.

 

OS version is 10.1.0.1483 and BuildID is 498812

 

Webworks SDK version is 1.0.4.11

Please use plain text.
BlackBerry Development Advisor
anzor_b
Posts: 164
Registered: ‎09-24-2012
My Device: White BlackBerry 10
My Carrier: Bell

Re: Cannot write to shared folder when in secure workspace

Hi Georgechr,

 

I was not able to reproduce your issue using a 10.1 Rogers public build, (a version slightly newer than yours), I am in the process of loading the same build as yours and testing to rule out a build issue.

 

Meanwhile, try/answer the following:

 

1) Do you get the prompt to allow shared_access when the app is first deployed through BES?

 

I've put the code for my test up on jsFiddle, here: http://jsfiddle.net/fPLq9/

Please test with my code if you get a chance.

 

Please use plain text.
Contributor
Georgechr
Posts: 45
Registered: ‎06-28-2013
My Device: Z10
My Carrier: None

Re: Cannot write to shared folder when in secure workspace

thanks for your response!

 

I managed to get it to work a few minutes ago. I switched it to log into its own sandbox and then I noticed that it did produce a log file in the work space's shared folder (from one of the previous run). I switched it back and it worked.. I must have been something awefully wrong even though this was happening in a really simple sample app.

 

My only wild guess is that my main app (possible) had the file open (would this cause the restriction?) as well. 

 

Much thanks for your help anyway! :smileyhappy:

 

Please use plain text.