cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblotsky <...@git.apache.org>
Subject [GitHub] cordova-paramedic pull request: Code changes for Collecting Device...
Date Wed, 13 Apr 2016 22:05:17 GMT
Github user dblotsky commented on a diff in the pull request:

    https://github.com/apache/cordova-paramedic/pull/4#discussion_r59634307
  
    --- 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);
    --- End diff --
    
    Please use 0644 instead of 0777 here. Also, please factor out the permissions setting
into a variable.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


Mime
View raw message