Electron 323: allow admins to set permissions to peripherals (#329)

- implement permissions settings for electron
- add "Yes" / "No" as user visible text in the windows installer confirmation screen
- add "Yes" / "No" as user visible text in the windows installer for settings screen
- fix windows installer conflicts
This commit is contained in:
Vishwas Shashidhar 2018-03-20 17:49:27 +05:30 committed by GitHub
parent 6a8592694e
commit 217299bcf8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 630 additions and 86 deletions

View File

@ -19,5 +19,14 @@
"authServerWhitelist": "",
"authNegotiateDelegateWhitelist": "",
"disableGpu": false
},
"permissions": {
"media": false,
"geolocation": true,
"notifications": true,
"midiSysex": true,
"pointerLock": true,
"fullscreen": false,
"openExternal": true
}
}
}

View File

@ -6,7 +6,7 @@
<dict>
<key>Resources/Base.lproj/MyInstallerPane.nib</key>
<data>
REWscTugC7Nqck170ufKwa7niM8=
ozgq40OwEdGzEYmpvPfyOGNdoxc=
</data>
<key>Resources/InstallerSections.plist</key>
<data>
@ -37,11 +37,11 @@
<dict>
<key>hash</key>
<data>
REWscTugC7Nqck170ufKwa7niM8=
ozgq40OwEdGzEYmpvPfyOGNdoxc=
</data>
<key>hash2</key>
<data>
7tVq2ZiKqlKpvUpE6okEaYi4n4W8rSdip7Oxp23CKC8=
o5paIuef2SCH3ReBvdV7oINRCSJTzFOAkbopJGY4pjY=
</data>
</dict>
<key>Resources/InstallerSections.plist</key>

View File

@ -22,18 +22,25 @@
<outlet property="bringToFrontCheckBox" destination="U3w-pH-PqJ" id="sdD-Dp-GpD"/>
<outlet property="bringToFrontTextBox" destination="oWV-om-PWr" id="bc6-cj-Zmy"/>
<outlet property="contentView" destination="TUK-W2-vig" id="gTd-A7-dof"/>
<outlet property="externalAppCheckBox" destination="aOc-wA-S9R" id="Z2r-Qs-qec"/>
<outlet property="fullScreenCheckBox" destination="4gT-80-aYv" id="kHn-lm-ayT"/>
<outlet property="geoLocationCheckBox" destination="alZ-bL-g68" id="7Bp-Nt-Y9R"/>
<outlet property="mediaCheckBox" destination="Fi3-3U-hd6" id="8gM-oP-dtz"/>
<outlet property="midiSysexCheckBox" destination="NI4-EF-6y8" id="5EN-j2-258"/>
<outlet property="minimizeOnCloseCheckBox" destination="XPe-yO-v9Y" id="ewr-3C-eNJ"/>
<outlet property="notificationsCheckBox" destination="zHq-Xk-yJA" id="f5a-4V-yiD"/>
<outlet property="parentSection" destination="-2" id="FB7-UV-e8k"/>
<outlet property="podUrlAlertTextBox" destination="wzk-BB-itI" id="Kab-Hu-5vF"/>
<outlet property="podUrlTextBox" destination="uwa-xi-M5X" id="vLY-gf-Cu7"/>
<outlet property="pointerLockCheckBox" destination="nR5-El-vtz" id="s6c-p1-60Q"/>
</connections>
</customObject>
<customView id="TUK-W2-vig" userLabel="View">
<rect key="frame" x="0.0" y="0.0" width="418" height="330"/>
<rect key="frame" x="0.0" y="0.0" width="445" height="365"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="kEO-Mr-GRW">
<rect key="frame" x="8" y="186" width="182" height="43"/>
<rect key="frame" x="8" y="276" width="182" height="43"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" title="Pod Url (This is where Symphony will be installed)" id="iRN-3c-tUz">
<font key="font" metaFont="system"/>
@ -42,7 +49,7 @@
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="iAw-NP-Tbm">
<rect key="frame" x="8" y="99" width="188" height="28"/>
<rect key="frame" x="194" y="227" width="188" height="28"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Minimize Symphony on Close" id="z1k-Zj-Big">
<font key="font" metaFont="system"/>
@ -51,7 +58,7 @@
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="KOx-3P-dPz">
<rect key="frame" x="8" y="135" width="146" height="28"/>
<rect key="frame" x="8" y="225" width="146" height="28"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Auto-launch Symphony" id="9id-I6-Bxu">
<font key="font" metaFont="system"/>
@ -60,7 +67,7 @@
</textFieldCell>
</textField>
<button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="XPe-yO-v9Y">
<rect key="frame" x="194" y="111" width="22" height="18"/>
<rect key="frame" x="383" y="235" width="22" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="uvu-EE-3sp">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
@ -68,7 +75,7 @@
</buttonCell>
</button>
<textField toolTip="Ex: https://my.symphony.com" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="uwa-xi-M5X">
<rect key="frame" x="196" y="197" width="207" height="32"/>
<rect key="frame" x="196" y="287" width="207" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="left" title="https://corporate.symphony.com" placeholderString="Ex: https://corporate.symphony.com" drawsBackground="YES" id="5g9-ba-etY">
<font key="font" metaFont="system"/>
@ -77,16 +84,16 @@
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="UYr-oC-RgI">
<rect key="frame" x="8" y="63" width="168" height="28"/>
<rect key="frame" x="8" y="191" width="146" height="28"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Symphony is always on top" id="7pE-fR-PoD">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Always on top" id="7pE-fR-PoD">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="8EB-K5-hjN">
<rect key="frame" x="194" y="75" width="22" height="18"/>
<rect key="frame" x="158" y="201" width="22" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" inset="2" id="chP-mD-3E9">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
@ -94,7 +101,7 @@
</buttonCell>
</button>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" allowsExpansionToolTips="YES" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wzk-BB-itI">
<rect key="frame" x="194" y="171" width="211" height="20"/>
<rect key="frame" x="194" y="261" width="211" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" id="xnq-4j-scy">
<font key="font" metaFont="smallSystem"/>
@ -103,7 +110,7 @@
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="oWV-om-PWr">
<rect key="frame" x="8" y="38" width="186" height="17"/>
<rect key="frame" x="194" y="203" width="186" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Bring to Front on Notifications" id="BMb-Um-fNF">
<font key="font" metaFont="system"/>
@ -112,7 +119,7 @@
</textFieldCell>
</textField>
<button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="zJM-2d-YYz">
<rect key="frame" x="194" y="147" width="22" height="18"/>
<rect key="frame" x="158" y="235" width="22" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="o5T-Og-ooq">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
@ -120,14 +127,152 @@
</buttonCell>
</button>
<button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="U3w-pH-PqJ">
<rect key="frame" x="194" y="37" width="22" height="18"/>
<rect key="frame" x="383" y="201" width="22" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" inset="2" id="Q95-3i-cEO">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="MX9-Kw-aZK">
<rect key="frame" x="119" y="163" width="180" height="25"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="Permissions" id="tJp-N4-bad">
<font key="font" metaFont="systemBold" size="16"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="AKh-s7-XRO">
<rect key="frame" x="10" y="133" width="67" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Media" id="C6j-DP-fsH">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="oEX-a7-qK5">
<rect key="frame" x="10" y="100" width="84" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Geo Location" id="eor-co-EFD">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="fpk-uy-dZ2">
<rect key="frame" x="10" y="69" width="81" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Notifications" id="i1k-aR-f09">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="oVg-c7-HzK">
<rect key="frame" x="10" y="38" width="69" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Midi Sysex" id="a4r-uQ-Z2f">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="r6F-Wf-pGn">
<rect key="frame" x="245" y="133" width="80" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Pointer Lock" id="uNZ-fQ-DCZ">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="GNi-3z-j8e">
<rect key="frame" x="245" y="100" width="72" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Full Screen" id="OhL-uM-1Co">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Lkf-vk-Y5u">
<rect key="frame" x="245" y="69" width="118" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Open External App" id="BRl-Pd-aRb">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Fi3-3U-hd6">
<rect key="frame" x="119" y="132" width="22" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="TuL-TV-s6h">
<behavior key="behavior" pushIn="YES" changeContents="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</button>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="alZ-bL-g68">
<rect key="frame" x="119" y="99" width="22" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="tmb-8Q-fC7">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</button>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="zHq-Xk-yJA">
<rect key="frame" x="119" y="68" width="22" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="pk8-T5-rVh">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</button>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="NI4-EF-6y8">
<rect key="frame" x="119" y="36" width="22" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="GGE-GT-Zv0">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</button>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="nR5-El-vtz">
<rect key="frame" x="378" y="132" width="22" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="eKN-q9-IVS">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</button>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="4gT-80-aYv">
<rect key="frame" x="378" y="99" width="22" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="LXD-88-nHc">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</button>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="aOc-wA-S9R">
<rect key="frame" x="378" y="68" width="22" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="qX5-oD-GFX">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="AjW-uy-6oH">
<rect key="frame" x="119" y="334" width="180" height="19"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="Basic Settings" id="Pri-nP-bN1">
<font key="font" metaFont="systemBold" size="16"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
<point key="canvasLocation" x="152.5" y="186.5"/>
</customView>
</objects>
</document>

View File

@ -17,4 +17,12 @@
@property (weak) IBOutlet NSButton *bringToFrontCheckBox;
@property (weak) IBOutlet NSTextField *bringToFrontTextBox;
@property (weak) IBOutlet NSButton *mediaCheckBox;
@property (weak) IBOutlet NSButton *geoLocationCheckBox;
@property (weak) IBOutlet NSButton *notificationsCheckBox;
@property (weak) IBOutlet NSButton *midiSysexCheckBox;
@property (weak) IBOutlet NSButton *pointerLockCheckBox;
@property (weak) IBOutlet NSButton *fullScreenCheckBox;
@property (weak) IBOutlet NSButton *externalAppCheckBox;
@end

View File

@ -25,20 +25,41 @@
// Now, validate the url against a url regex
NSString *regex = @"^(https:\\/\\/)?(www.)?[a-z0-9]+([\\-\\.]{1}[a-z0-9]+)*\\.[a-z]{2,}(:[0-9]{1,5})?(\\/[a-zA-Z0-9-_.+!*'(),;\\/?:@=&$]*)?$";
NSPredicate *podUrlTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex];
if ([podUrlTest evaluateWithObject:podUrl]) {
return YES;
if (![podUrlTest evaluateWithObject:podUrl]) {
[_podUrlAlertTextBox setTitleWithMnemonic:@"Please enter a valid Pod url."];
return NO;
}
// In case of an invalid url, display the message under the pod url text box
// and don't go to the next screen, hence return NO
[_podUrlAlertTextBox setTitleWithMnemonic:@"Please enter a valid Pod url."];
return NO;
// Double confirmation for disabling media
if ([_mediaCheckBox state] == 0) {
NSAlert *alert = [NSAlert alertWithMessageText: @"Are you sure you wish to disable the camera, microphone, and speakers?" defaultButton:@"No" alternateButton:@"Yes" otherButton:nil informativeTextWithFormat:@""];
NSInteger button = [alert runModal];
if (button == NSAlertDefaultReturn) {
return NO;
}
return YES;
}
return YES;
}
- (void)willExitPane:(InstallerSectionDirection)dir {
[self writeSettingsToFile];
[self writePermissionsToFile];
}
- (void)writeSettingsToFile {
NSString *podUrl = [_podUrlTextBox stringValue];
NSString *securePrefix = @"https://";
@ -46,7 +67,7 @@
podUrl = [securePrefix stringByAppendingString:podUrl];
[_podUrlTextBox setStringValue:podUrl];
}
// By default, set autoLaunchOnStart and minimizeOnClose to true
NSString *autoLaunchOnStart = @"true";
NSString *minimizeOnClose = @"true";
@ -86,4 +107,54 @@
}
- (void)writePermissionsToFile {
// By default, set all the values to true
NSString *media = @"true";
NSString *geoLocation = @"true";
NSString *notifications = @"true";
NSString *midiSysex = @"true";
NSString *pointerLock = @"true";
NSString *fullScreen = @"true";
NSString *openExternal = @"true";
if ([_mediaCheckBox state] == 0) {
media = @"false";
}
if ([_geoLocationCheckBox state] == 0) {
geoLocation = @"false";
}
if ([_notificationsCheckBox state] == 0) {
notifications = @"false";
}
if ([_midiSysexCheckBox state] == 0) {
midiSysex = @"false";
}
if ([_pointerLockCheckBox state] == 0) {
pointerLock = @"false";
}
if ([_fullScreenCheckBox state] == 0) {
fullScreen = @"false";
}
if ([_externalAppCheckBox state] == 0) {
openExternal = @"false";
}
// Create an array with the selected options
NSArray *symPermissions = [[NSArray alloc] initWithObjects:media, geoLocation, notifications, midiSysex, pointerLock, fullScreen, openExternal, nil];
// Create a string from the array with new-line as the separator
NSString *symPermissionsString = [symPermissions componentsJoinedByString:@"\n"];
// Write all the above settings to file
[symPermissionsString writeToFile:@"/tmp/sym_permissions.txt" atomically:YES encoding:NSUTF8StringEncoding error:nil];
}
@end

View File

@ -1,17 +1,18 @@
#!/bin/sh
## Create file path variables ##
tempFilePath='/tmp/sym_settings.txt'
settingsFilePath='/tmp/sym_settings.txt'
permissionsFilePath='/tmp/sym_permissions.txt'
installPath="$2"
configPath="/Symphony.app/Contents/config/Symphony.config"
newPath=${installPath}${configPath}
## Get Symphony Settings from the temp file ##
pod_url=$(sed -n '1p' ${tempFilePath});
minimize_on_close=$(sed -n '2p' '/tmp/sym_settings.txt');
launch_on_startup=$(sed -n '3p' '/tmp/sym_settings.txt');
always_on_top=$(sed -n '4p' '/tmp/sym_settings.txt');
bring_to_front=$(sed -n '5p' '/tmp/sym_settings.txt');
pod_url=$(sed -n '1p' ${settingsFilePath});
minimize_on_close=$(sed -n '2p' ${settingsFilePath});
launch_on_startup=$(sed -n '3p' ${settingsFilePath});
always_on_top=$(sed -n '4p' ${settingsFilePath});
bring_to_front=$(sed -n '5p' ${settingsFilePath});
if [ "$pod_url" == "" ]; then
pod_url="https://corporate.symphony.com"
@ -43,9 +44,58 @@ sed -i "" -E "s#\"launchOnStartup\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#
sed -i "" -E "s#\"bringToFront\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"bringToFront\":\ $bring_to_front#g" ${newPath}
## Remove the temp settings file created ##
rm -f ${tempFilePath}
rm -f ${settingsFilePath}
## Get Symphony Permissions from the temp file ##
media=$(sed -n '1p' ${permissionsFilePath});
geo_location=$(sed -n '2p' ${permissionsFilePath});
notifications=$(sed -n '3p' ${permissionsFilePath});
midi_sysex=$(sed -n '4p' ${permissionsFilePath});
pointer_lock=$(sed -n '5p' ${permissionsFilePath});
full_screen=$(sed -n '6p' ${permissionsFilePath});
open_external_app=$(sed -n '7p' ${permissionsFilePath});
if [ "$media" == "" ]; then
media=true;
fi
if [ "$geo_location" == "" ]; then
geo_location=true;
fi
if [ "$notifications" == "" ]; then
notifications=true;
fi
if [ "$midi_sysex" == "" ]; then
midi_sysex=true;
fi
if [ "$pointer_lock" == "" ]; then
pointer_lock=true;
fi
if [ "$full_screen" == "" ]; then
full_screen=true;
fi
if [ "$open_external_app" == "" ]; then
open_external_app=true;
fi
## Replace the default permissions with the user selected permissions ##
sed -i "" -E "s#\"media\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"media\":\ $media#g" ${newPath}
sed -i "" -E "s#\"geolocation\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"geolocation\":\ $geo_location#g" ${newPath}
sed -i "" -E "s#\"notifications\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"notifications\":\ $notifications#g" ${newPath}
sed -i "" -E "s#\"midiSysex\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"midiSysex\":\ $midi_sysex#g" ${newPath}
sed -i "" -E "s#\"pointerLock\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"pointerLock\":\ $pointer_lock#g" ${newPath}
sed -i "" -E "s#\"fullscreen\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"fullscreen\":\ $full_screen#g" ${newPath}
sed -i "" -E "s#\"openExternal\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"openExternal\":\ $open_external_app#g" ${newPath}
## Remove the temp permissions file created ##
rm -f ${permissionsFilePath}
## For launching symphony with sandbox enabled, create a shell script that is used as the launch point for the app
EXEC_PATH=${installPath}/Symphony.app/Contents/MacOS
exec ${EXEC_PATH}/Symphony --install ${newPath} ${launch_on_startup}
chmod 755 ${EXEC_PATH}/Symphony
chmod 755 ${EXEC_PATH}/Symphony

View File

@ -5,6 +5,10 @@
<key>PACKAGES</key>
<array>
<dict>
<key>MUST-CLOSE-APPLICATION-ITEMS</key>
<array/>
<key>MUST-CLOSE-APPLICATIONS</key>
<false/>
<key>PACKAGE_FILES</key>
<dict>
<key>DEFAULT_INSTALL_LOCATION</key>
@ -267,7 +271,7 @@
<key>PATH_TYPE</key>
<integer>0</integer>
<key>PERMISSIONS</key>
<integer>493</integer>
<integer>1005</integer>
<key>TYPE</key>
<integer>1</integer>
<key>UID</key>
@ -439,7 +443,7 @@
<key>TREAT_MISSING_FILES_AS_WARNING</key>
<false/>
<key>VERSION</key>
<integer>4</integer>
<integer>5</integer>
</dict>
<key>PACKAGE_SCRIPTS</key>
<dict>
@ -478,6 +482,8 @@
<false/>
<key>PAYLOAD_SIZE</key>
<integer>-1</integer>
<key>REFERENCE_PATH</key>
<string></string>
<key>RELOCATABLE</key>
<false/>
<key>USE_HFS+_COMPRESSION</key>
@ -599,7 +605,7 @@
<key>PATH</key>
<string>SymphonySettingsPlugin.bundle</string>
<key>PATH_TYPE</key>
<integer>3</integer>
<integer>1</integer>
</dict>
</dict>
<dict>
@ -888,4 +894,4 @@
<key>VERSION</key>
<integer>2</integer>
</dict>
</plist>
</plist>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -223,6 +223,8 @@ function doCreateMainWindow(initialUrl, initialBounds, isCustomTitleBar) {
}
});
});
handlePermissionRequests(mainWindow.webContents);
addWindowKey(key, mainWindow);
mainWindow.loadURL(url);
@ -478,6 +480,8 @@ function doCreateMainWindow(initialUrl, initialBounds, isCustomTitleBar) {
sendChildWinBoundsChange.bind(null, browserWin));
browserWin.on('move', throttledBoundsChange);
browserWin.on('resize', throttledBoundsChange);
handlePermissionRequests(browserWin.webContents);
}
});
} else {
@ -500,6 +504,77 @@ function doCreateMainWindow(initialUrl, initialBounds, isCustomTitleBar) {
});
});
});
// ELECTRON-323: Handle session permission requests
function handlePermissionRequests(webContents) {
let session = webContents.session;
getConfigField('permissions')
.then((permissions) => {
if (!permissions) {
log.send(logLevels.ERROR, 'permissions configuration is invalid, so, everything will be true by default!');
return;
}
session.setPermissionRequestHandler((sessionWebContents, permission, callback) => {
function handleSessionPermissions(userPermission, message, cb) {
log.send(logLevels.INFO, 'permission is -> ' + userPermission);
if (!userPermission) {
let fullMessage = `Your administrator has disabled ${message}. Please contact your admin for help.`;
electron.dialog.showErrorBox('Permission Denied!', fullMessage);
}
return cb(userPermission);
}
let PERMISSION_MEDIA = 'media';
let PERMISSION_LOCATION = 'geolocation';
let PERMISSION_NOTIFICATIONS = 'notifications';
let PERMISSION_MIDI_SYSEX = 'midiSysex';
let PERMISSION_POINTER_LOCK = 'pointerLock';
let PERMISSION_FULL_SCREEN = 'fullscreen';
let PERMISSION_OPEN_EXTERNAL = 'openExternal';
switch (permission) {
case PERMISSION_MEDIA:
return handleSessionPermissions(permissions.media, 'sharing your camera, microphone, and speakers', callback);
case PERMISSION_LOCATION:
return handleSessionPermissions(permissions.geolocation, 'sharing your location', callback);
case PERMISSION_NOTIFICATIONS:
return handleSessionPermissions(permissions.notifications, 'notifications', callback);
case PERMISSION_MIDI_SYSEX:
return handleSessionPermissions(permissions.midiSysex, 'MIDI Sysex', callback);
case PERMISSION_POINTER_LOCK:
return handleSessionPermissions(permissions.pointerLock, 'Pointer Lock', callback);
case PERMISSION_FULL_SCREEN:
return handleSessionPermissions(permissions.fullscreen, 'Full Screen', callback);
case PERMISSION_OPEN_EXTERNAL:
return handleSessionPermissions(permissions.openExternal, 'Opening External App', callback);
default:
return callback(false);
}
});
}).catch((error) => {
log.send(logLevels.ERROR, 'unable to get permissions configuration, so, everything will be true by default! ' + error);
})
}
}
@ -753,12 +828,11 @@ function checkExternalDisplay(appBounds) {
const width = appBounds.width;
const height = appBounds.height;
const factor = 0.2;
const screen = electron.screen;
// Loops through all the available displays and
// verifies if the wrapper exists within the display bounds
// returns false if not exists otherwise true
return !!screen.getAllDisplays().find(({ bounds }) => {
return !!electron.screen.getAllDisplays().find(({ bounds }) => {
const leftMost = x + (width * factor);
const topMost = y + (height * factor);
@ -779,9 +853,8 @@ function checkExternalDisplay(appBounds) {
* was removed and if the wrapper was contained within that bounds
*/
function repositionMainWindow() {
const screen = electron.screen;
const { workArea } = screen.getPrimaryDisplay();
const { workArea } = electron.screen.getPrimaryDisplay();
const bounds = workArea;
if (!bounds) {