You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by an...@apache.org on 2016/06/02 11:41:12 UTC

[1/2] cordova-paramedic git commit: Update permissions helper to patch TCC.db in case if permission entry already exists

Repository: cordova-paramedic
Updated Branches:
  refs/heads/ci/ios [created] c2d40cb6d


Update permissions helper to patch TCC.db in case if permission entry already exists


Project: http://git-wip-us.apache.org/repos/asf/cordova-paramedic/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-paramedic/commit/8bdbec10
Tree: http://git-wip-us.apache.org/repos/asf/cordova-paramedic/tree/8bdbec10
Diff: http://git-wip-us.apache.org/repos/asf/cordova-paramedic/diff/8bdbec10

Branch: refs/heads/ci/ios
Commit: 8bdbec1015fd05da9bc961b06bdb6012cc308cdf
Parents: d270995
Author: Administrator <Ad...@medic-mbp.rp.ru>
Authored: Thu Jun 2 14:05:37 2016 +0300
Committer: Administrator <Ad...@medic-mbp.rp.ru>
Committed: Thu Jun 2 14:05:37 2016 +0300

----------------------------------------------------------------------
 lib/ParamediciOSPermissions.js | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-paramedic/blob/8bdbec10/lib/ParamediciOSPermissions.js
----------------------------------------------------------------------
diff --git a/lib/ParamediciOSPermissions.js b/lib/ParamediciOSPermissions.js
index a6e5e3d..eca8d13 100644
--- a/lib/ParamediciOSPermissions.js
+++ b/lib/ParamediciOSPermissions.js
@@ -26,6 +26,7 @@ var fs      = require('fs');
 var shelljs = require('shelljs');
 var logger  = require('./utils').logger;
 var util    = require('./utils').utilities;
+var nodeutil    = require('util');
 
 var TCC_FOLDER_PERMISSION = 0755;
 
@@ -56,7 +57,20 @@ ParamediciOSPermissions.prototype.updatePermissions = function (serviceList){
         logger.info('Running Command: ' + command);
         // If the service has an entry already, the insert command will fail.
         // But, such a failure is intentionally not handled here.
-        shelljs.exec(command, {silent: true, async: false});
+        var proc = shelljs.exec(command, {silent: true, async: false});
+        if (proc.code) {
+            logger.warn('Failed to insert permissions for ' + this.appName + ' into ' + destinationTCCFile +
+                ' Will try to update existing permissions.');
+
+            // (service, client, client_type, allowed, prompt_count, csreq)
+            command = nodeutil.format('sqlite3 %s "update access set client_type=0, allowed=1, prompt_count=1, csreq=NULL where service=\'%s\', and client=\'%s\'"', serviceList[i], this.appName);
+            logger.info('Running Command: ' + command);
+            // Now we really don't care about the result as there is nothing we can do with this
+            if (shelljs.exec(command, {silent: true, async: false}).code) {
+                logger.warn('Failed to update existing permissions for ' + this.appName + ' into ' + destinationTCCFile +
+                ' Continuing anyway.');
+            }
+        }
     }
 };
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[2/2] cordova-paramedic git commit: Add debug code to permission helper

Posted by an...@apache.org.
Add debug code to permission helper


Project: http://git-wip-us.apache.org/repos/asf/cordova-paramedic/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-paramedic/commit/c2d40cb6
Tree: http://git-wip-us.apache.org/repos/asf/cordova-paramedic/tree/c2d40cb6
Diff: http://git-wip-us.apache.org/repos/asf/cordova-paramedic/diff/c2d40cb6

Branch: refs/heads/ci/ios
Commit: c2d40cb6deadc198a945e872f208c51a320a79cd
Parents: 8bdbec1
Author: Administrator <Ad...@medic-mbp.rp.ru>
Authored: Thu Jun 2 14:39:23 2016 +0300
Committer: Administrator <Ad...@medic-mbp.rp.ru>
Committed: Thu Jun 2 14:39:23 2016 +0300

----------------------------------------------------------------------
 lib/ParamediciOSPermissions.js | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-paramedic/blob/c2d40cb6/lib/ParamediciOSPermissions.js
----------------------------------------------------------------------
diff --git a/lib/ParamediciOSPermissions.js b/lib/ParamediciOSPermissions.js
index eca8d13..a716a86 100644
--- a/lib/ParamediciOSPermissions.js
+++ b/lib/ParamediciOSPermissions.js
@@ -59,14 +59,19 @@ ParamediciOSPermissions.prototype.updatePermissions = function (serviceList){
         // But, such a failure is intentionally not handled here.
         var proc = shelljs.exec(command, {silent: true, async: false});
         if (proc.code) {
+            logger.warn(proc.output);
             logger.warn('Failed to insert permissions for ' + this.appName + ' into ' + destinationTCCFile +
                 ' Will try to update existing permissions.');
 
             // (service, client, client_type, allowed, prompt_count, csreq)
-            command = nodeutil.format('sqlite3 %s "update access set client_type=0, allowed=1, prompt_count=1, csreq=NULL where service=\'%s\', and client=\'%s\'"', serviceList[i], this.appName);
+            command = nodeutil.format('sqlite3 %s "update access ' +
+                'set client_type=0, allowed=1, prompt_count=1, csreq=NULL ' +
+                'where service=\'%s\' and client=\'%s\'"', destinationTCCFile, serviceList[i], this.appName);
             logger.info('Running Command: ' + command);
             // Now we really don't care about the result as there is nothing we can do with this
-            if (shelljs.exec(command, {silent: true, async: false}).code) {
+            var patchProc = shelljs.exec(command, {silent: true, async: false});
+            if (patchProc.code) {
+                logger.warn(patchProc.output);
                 logger.warn('Failed to update existing permissions for ' + this.appName + ' into ' + destinationTCCFile +
                 ' Continuing anyway.');
             }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org