Github user rakatyal commented on a diff in the pull request:

    https://github.com/apache/cordova-paramedic/pull/4#discussion_r59745115
  
    --- Diff: lib/ParamedicPermissions.js ---
    @@ -0,0 +1,60 @@
    +#!/usr/bin/env node
    +
    +/* jshint node: true */
    +var path    = require('path');
    +var fs              = require('fs');
    +var shelljs  = require("shelljs");
    +var logger  = require('./utils').logger;
    +
    +function ParamedicPermissions(appName, simulatorsFolder, dbPath) {
    +   this.appName = appName;
    +   this.simulatorsFolder = simulatorsFolder;
    +   this.dbPath = dbPath;
    +}
    +
    +ParamedicPermissions.prototype.updatePermissions = function(serviceList){
    +   var self = this;
    +   this.getDirectories(self.simulatorsFolder).forEach(function(simFolder){
    +           var destinationTCCFile = path.join(self.simulatorsFolder, 
simFolder, '/data/Library/TCC/TCC.db');
    +
    +           //Check if the simFolder has TCC.db file in it
    +           if(self.doesFileExist(destinationTCCFile)) {
    +                   var sqlite3Command_firstPart  = 'sqlite3 ' + 
destinationTCCFile;
    +                   var sqlite3Command_secondPart = ' "insert into 
access(service, client, client_type, allowed, prompt_count, csreq) values(\'';
    +                   var sqlite3Command_lastPart   = '\',\'' + self.appName 
+ '\',0,1,1,NULL)"';
    +                   serviceList.forEach(function(service){
    +                           var command = sqlite3Command_firstPart  +  
sqlite3Command_secondPart + service + sqlite3Command_lastPart ;
    +                           logger.info("Running Command: " + command);
    +                           shelljs.exec(command, {silent: true, async: 
false});
    +                   });
    +           } else {
    +                   // No TCC.db file exists by default. So, Copy the new 
TCC.db file
    +                   var destinationTCCFolder = 
path.join(self.simulatorsFolder, simFolder, '/data/Library/TCC');
    +                   if(!self.doesFileExist(destinationTCCFolder)){
    +                           fs.mkdir(destinationTCCFolder, 0777);
    +                   }
    +                   var command = "cp " + self.dbPath + " " + 
destinationTCCFolder;
    +                   logger.info("Running Command: " + command);
    +                   shelljs.exec(command, {silent: true, async: false});
    +           }
    +   });
    +}
    +
    +ParamedicPermissions.prototype.getDirectories = function(srcpath) {
    --- End diff --
    
    Consider renaming it srcPath.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org
For additional commands, e-mail: dev-h...@cordova.apache.org

Reply via email to