cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From an-s...@apache.org
Subject [1/2] cordova-paramedic git commit: Update permissions helper to patch TCC.db in case if permission entry already exists
Date Thu, 02 Jun 2016 11:41:12 GMT
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 <Administrator@medic-mbp.rp.ru>
Authored: Thu Jun 2 14:05:37 2016 +0300
Committer: Administrator <Administrator@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


Mime
View raw message