diff --git a/blue-shark/ui/field-search-multiple.reel/field-search-multiple.html b/blue-shark/ui/field-search-multiple.reel/field-search-multiple.html index 5f6ea995c1..6ee9e41598 100644 --- a/blue-shark/ui/field-search-multiple.reel/field-search-multiple.html +++ b/blue-shark/ui/field-search-multiple.reel/field-search-multiple.html @@ -33,9 +33,7 @@ "disabled": {"<-": "@owner.disabled"}, "controller": {"<-": "@owner.controller"}, "initialOptions": {"<-": "@owner.initialOptions"}, - "labelExpression": {"<-": "@owner.labelExpression"}, "labelPath": {"<-": "@owner.labelPath"}, - "valuePath": {"<-": "@owner.valuePath"}, "values": {"<->": "@owner.values"} } } diff --git a/blue-shark/ui/field-search.reel/field-search.html b/blue-shark/ui/field-search.reel/field-search.html index 05d7439d2f..b8d14195bb 100644 --- a/blue-shark/ui/field-search.reel/field-search.html +++ b/blue-shark/ui/field-search.reel/field-search.html @@ -33,8 +33,6 @@ "disabled": {"<-": "@owner.disabled"}, "controller": {"<-": "@owner.controller"}, "labelPath": {"<-": "@owner.labelPath"}, - "labelExpression": {"<-": "@owner.labelExpression"}, - "valuePath": {"<-": "@owner.valuePath"}, "initialOptions": {"<-": "@owner.initialOptions"}, "hasNoneButton": {"<-": "@owner.hasNoneButton"}, "value": {"<->": "@owner.value"} diff --git a/blue-shark/ui/search-multiple.reel/search-multiple.html b/blue-shark/ui/search-multiple.reel/search-multiple.html index 4903d15888..cc6cc37a9c 100644 --- a/blue-shark/ui/search-multiple.reel/search-multiple.html +++ b/blue-shark/ui/search-multiple.reel/search-multiple.html @@ -80,7 +80,7 @@ "element": {"#": "select"} }, "bindings": { - "options": {"<-": "@owner._results.map{{label: this.path(@owner.labelPath), value: this.path(@owner.valuePath)}}"} + "options": {"<-": "@owner._results.map{{label: this.path(@owner.labelPath), value: this.path(@owner.labelPath)}}"} } }, diff --git a/blue-shark/ui/search-multiple.reel/search-multiple.js b/blue-shark/ui/search-multiple.reel/search-multiple.js index 8b9e69556c..a440817681 100644 --- a/blue-shark/ui/search-multiple.reel/search-multiple.js +++ b/blue-shark/ui/search-multiple.reel/search-multiple.js @@ -34,7 +34,7 @@ exports.SearchMultiple = Search.specialize(/** @lends SearchMultiple# */ { _.concat(this.values || [], _.difference(this._results, _.differenceWith(this._results, this._selectComponent.selectedValues, function (object, value) { - return object[self.valuePath] === value; + return object[self.labelPath] === value; }) ) ) diff --git a/blue-shark/ui/search.reel/search.html b/blue-shark/ui/search.reel/search.html index 545946a6ba..b95808ce3d 100644 --- a/blue-shark/ui/search.reel/search.html +++ b/blue-shark/ui/search.reel/search.html @@ -80,7 +80,7 @@ "allowMultiple": false }, "bindings": { - "options": {"<-": "@owner._results.map{{label: this.path(@owner.labelPath), value: this.path(@owner.valuePath)}}"} + "options": {"<-": "@owner._results.map{{label: this.path(@owner.labelPath), value: this.path(@owner.labelPath)}}"} } }, diff --git a/blue-shark/ui/search.reel/search.js b/blue-shark/ui/search.reel/search.js index 6dcd4c9e8c..5cba5045cc 100644 --- a/blue-shark/ui/search.reel/search.js +++ b/blue-shark/ui/search.reel/search.js @@ -16,8 +16,9 @@ exports.Search = Component.specialize(/** @lends Search# */ { value: { set: function (value) { - this._value = value ? this.valuePath ? value[this.valuePath] || value : value : null; - this.displayedValue = value ? this.labelPath ? value[this.labelPath] || value : value : 'none'; + this._value = value; + this.displayedValue = value ? this.labelPath ? + value[this.labelPath] || (typeof value === 'string' ? value : 'none') : value : 'none'; }, get: function () { return this._value; @@ -68,7 +69,7 @@ exports.Search = Component.specialize(/** @lends Search# */ { selectedValue = this._selectComponent.selectedValues[0]; this.value = _.find(this._results, function (result) { - return result[self.valuePath] === selectedValue; + return result[self.labelPath] === selectedValue; }); } diff --git a/ui/abstract/abstract-search-account.js b/ui/abstract/abstract-search-account.js index 847250eb8b..20da5c7358 100644 --- a/ui/abstract/abstract-search-account.js +++ b/ui/abstract/abstract-search-account.js @@ -30,25 +30,6 @@ exports.AbstractSearchAccount = Component.specialize({ } }, - _valuePath: { - value: null - }, - - valuePath: { - set: function (path) { - if (this._valuePath !== path) { - if (typeof path === "string" && path.length) { - this._valuePath = path; - } else { - this._valuePath = null; - } - } - }, - get: function () { - return this._valuePath || this.constructor.valuePath; - } - }, - _isLoading: { value: null }, diff --git a/ui/controls/search-groups-multiple.reel/search-groups-multiple.html b/ui/controls/search-groups-multiple.reel/search-groups-multiple.html index 42c18c9dbd..26fc527bb5 100644 --- a/ui/controls/search-groups-multiple.reel/search-groups-multiple.html +++ b/ui/controls/search-groups-multiple.reel/search-groups-multiple.html @@ -23,7 +23,6 @@ "initialOptions": {"<-": "@owner.initialOptions"}, "hasNoneButton": {"<-": "@owner.hasNoneButton"}, "labelPath": {"<-": "@owner.labelPath"}, - "valuePath": {"<-": "@owner.valuePath"}, "validationPath": {"<-": "@owner.validationPath"} } } diff --git a/ui/controls/search-groups-multiple.reel/search-groups-multiple.js b/ui/controls/search-groups-multiple.reel/search-groups-multiple.js index a510fc051e..13466ed0bb 100644 --- a/ui/controls/search-groups-multiple.reel/search-groups-multiple.js +++ b/ui/controls/search-groups-multiple.reel/search-groups-multiple.js @@ -25,10 +25,6 @@ exports.SearchGroupsMultiple = AbstractSearchAccountMultiple.specialize(/** @len labelPath: { value: 'name' - }, - - valuePath: { - value: 'id' } }); diff --git a/ui/controls/search-groups.reel/search-groups.html b/ui/controls/search-groups.reel/search-groups.html index 663997b87e..a97fff2df7 100644 --- a/ui/controls/search-groups.reel/search-groups.html +++ b/ui/controls/search-groups.reel/search-groups.html @@ -18,7 +18,6 @@ "bindings": { "value": {"<->": "@owner.value"}, "labelPath": {"<-": "@owner.labelPath"}, - "valuePath": {"<-": "@owner.valuePath"}, "label": {"<-": "@owner.label"}, "disabled": {"<-": "@owner.disabled"}, "isLoading": {"<-": "@owner.isLoading"}, diff --git a/ui/controls/search-groups.reel/search-groups.js b/ui/controls/search-groups.reel/search-groups.js index 379a16d7c0..fe61314619 100644 --- a/ui/controls/search-groups.reel/search-groups.js +++ b/ui/controls/search-groups.reel/search-groups.js @@ -25,10 +25,6 @@ exports.SearchGroups = AbstractSearchAccount.specialize(/** @lends SearchGroups# labelPath: { value: 'name' - }, - - valuePath: { - value: 'id' } }); diff --git a/ui/controls/search-users-multiple.reel/search-users-multiple.html b/ui/controls/search-users-multiple.reel/search-users-multiple.html index 83f790d628..32b6e478e8 100644 --- a/ui/controls/search-users-multiple.reel/search-users-multiple.html +++ b/ui/controls/search-users-multiple.reel/search-users-multiple.html @@ -23,7 +23,6 @@ "initialOptions": {"<-": "@owner.initialOptions"}, "hasNoneButton": {"<-": "@owner.hasNoneButton"}, "labelPath": {"<-": "@owner.labelPath"}, - "valuePath": {"<-": "@owner.valuePath"}, "validationPath": {"<-": "@owner.validationPath"} } } diff --git a/ui/controls/search-users-multiple.reel/search-users-multiple.js b/ui/controls/search-users-multiple.reel/search-users-multiple.js index 9130002dcf..d2dd34096f 100644 --- a/ui/controls/search-users-multiple.reel/search-users-multiple.js +++ b/ui/controls/search-users-multiple.reel/search-users-multiple.js @@ -25,10 +25,6 @@ exports.SearchUsersMultiple = AbstractSearchAccountMultiple.specialize(/** @lend labelPath: { value: 'username' - }, - - valuePath: { - value: 'id' } }); diff --git a/ui/controls/search-users.reel/search-users.html b/ui/controls/search-users.reel/search-users.html index d7a1328cf1..8614ea1139 100644 --- a/ui/controls/search-users.reel/search-users.html +++ b/ui/controls/search-users.reel/search-users.html @@ -21,7 +21,6 @@ "disabled": {"<-": "@owner.disabled"}, "isLoading": {"<-": "@owner.isLoading"}, "labelPath": {"<-": "@owner.labelPath"}, - "valuePath": {"<-": "@owner.valuePath"}, "initialOptions": {"<-": "@owner.initialOptions"}, "validationPath": {"<-": "@owner.validationPath"}, "hasNoneButton": {"<-": "@owner.hasNoneButton"} diff --git a/ui/controls/search-users.reel/search-users.js b/ui/controls/search-users.reel/search-users.js index 3dca9f091d..49524841b3 100644 --- a/ui/controls/search-users.reel/search-users.js +++ b/ui/controls/search-users.reel/search-users.js @@ -25,10 +25,6 @@ exports.SearchUsers = AbstractSearchAccount.specialize(/** @lends SearchGroups# labelPath: { value: 'username' - }, - - valuePath: { - value: 'id' } }); diff --git a/ui/inspectors/calendar-task.reel/calendar-task.html b/ui/inspectors/calendar-task.reel/calendar-task.html index 371fc51d45..4d4e25b4bd 100644 --- a/ui/inspectors/calendar-task.reel/calendar-task.html +++ b/ui/inspectors/calendar-task.reel/calendar-task.html @@ -75,6 +75,7 @@ "bindings": { "moduleId": {"<-": "'ui/inspectors/calendar-task.reel/' + @owner.taskToInspector[@owner.object.task] + '-args.reel'"}, "object": {"<->": "@owner.object.args"}, + "context": {"<->": "@owner.context"}, "component.isNew": {"<-": "@owner.object._isNew"} } }, diff --git a/ui/inspectors/calendar-task.reel/calendar-task.js b/ui/inspectors/calendar-task.reel/calendar-task.js index 5c748e8655..ab6a7afcfa 100644 --- a/ui/inspectors/calendar-task.reel/calendar-task.js +++ b/ui/inspectors/calendar-task.reel/calendar-task.js @@ -92,15 +92,8 @@ exports.CalendarTask = AbstractInspector.specialize({ this._sectionService.updateScheduleOnTask(this.object); delete this.object.status; - var argsPromise = this.object.args; - if (this.argsInspector && typeof this.argsInspector.save === 'function') { - argsPromise = this.argsInspector.save(this.object); - } - argsPromise = Promise.is(argsPromise) ? argsPromise : this.resolveArgs(argsPromise); - var self = this; - return argsPromise.then(function(args) { - self.object.args = args; + return this._saveCalendarTaskArgs().then(function () { return self.inspector.save(); }); } @@ -117,15 +110,9 @@ exports.CalendarTask = AbstractInspector.specialize({ handleRunNowAction: { value: function () { - var argsPromise = this.object.args; - if (this.argsInspector && typeof this.argsInspector.save === 'function') { - argsPromise = this.argsInspector.save(this.object); - } - var self = this, - argsPromise = Promise.is(argsPromise) ? argsPromise : Promise.resolve(argsPromise); + var self = this; - return argsPromise.then(function(args) { - self.object.args = args; + return this._saveCalendarTaskArgs().then(function () { return self._sectionService.runTask(self.object); }); } @@ -141,6 +128,35 @@ exports.CalendarTask = AbstractInspector.specialize({ } }, + _saveCalendarTaskArgs: { + value: function () { + var args = this._prepareCalendarTaskArgs(), + self = this; + + if (this.argsInspector && typeof this.argsInspector.save === 'function') { + args = this.argsInspector.save(this.object); + } + + return (Promise.is(args) ? args : Promise.resolve(args)).then(function (args) { + self.object.args = args; + }); + } + }, + + _prepareCalendarTaskArgs: { + value: function () { + var args = this.object.args; + + if (this.taskToInspector[this.object.task] === 'cron') { + args[0] = this.context.cronUser.username; + } else if (this.taskToInspector[this.object.task] === 'rsync' && args[0]) { + args[0].user = this.context.rsyncUser.username; + } + + return args; + } + }, + _handleSimpleScheduleChange: { value: function() { this.scheduleString = this._sectionService.getScheduleStringForTask(this.object); diff --git a/ui/inspectors/calendar-task.reel/cron-args.reel/cron-args.html b/ui/inspectors/calendar-task.reel/cron-args.reel/cron-args.html index 2796468b6b..6347434e80 100644 --- a/ui/inspectors/calendar-task.reel/cron-args.reel/cron-args.html +++ b/ui/inspectors/calendar-task.reel/cron-args.reel/cron-args.html @@ -8,6 +8,9 @@ "owner": { "properties": { "element": {"#": "owner"} + }, + "bindings": { + "context.cronUser": {"<-": "@owner.object.0.{username: this}"} } }, "command": { @@ -24,11 +27,10 @@ "prototype": "ui/controls/search-users.reel", "properties": { "element": {"#": "user"}, - "label": "User", - "valuePath": "username" + "label": "User" }, "bindings": { - "value": {"<->": "@owner.object.0"} + "value": {"<->": "@owner.context.cronUser"} } } } diff --git a/ui/inspectors/calendar-task.reel/rsync-args.reel/rsync-args.html b/ui/inspectors/calendar-task.reel/rsync-args.reel/rsync-args.html index 1cb411516c..1d075d69ee 100644 --- a/ui/inspectors/calendar-task.reel/rsync-args.reel/rsync-args.html +++ b/ui/inspectors/calendar-task.reel/rsync-args.reel/rsync-args.html @@ -8,6 +8,9 @@ "owner": { "properties": { "element": {"#": "owner"} + }, + "bindings": { + "context.rsyncUser": {"<-": "@owner.object.0.user.{username: this}"} } }, "mode": { @@ -36,11 +39,10 @@ "prototype": "ui/controls/search-users.reel", "properties": { "element": {"#": "user"}, - "label": "User", - "valuePath": "username" + "label": "User" }, "bindings": { - "value": {"<->": "@owner.object.0.user"} + "value": {"<->": "@owner.context.rsyncUser"} } }, "path": { diff --git a/ui/inspectors/service.reel/afp-service.reel/afp-service.html b/ui/inspectors/service.reel/afp-service.reel/afp-service.html index a6ba5f48c1..8c804208f0 100644 --- a/ui/inspectors/service.reel/afp-service.reel/afp-service.html +++ b/ui/inspectors/service.reel/afp-service.reel/afp-service.html @@ -8,6 +8,9 @@ "owner": { "properties": { "element": {"#": "owner"} + }, + "bindings": { + "context.guestUser": {"<-": "@owner.object.guest_user.{username: this}"} } }, "positiveIntegerValidator": { @@ -71,11 +74,10 @@ "prototype": "ui/controls/search-users.reel", "properties": { "element": {"#": "guest_user"}, - "label": "Guest User", - "valuePath": "username" + "label": "Guest User" }, "bindings": { - "value": {"<->": "@owner.object.guest_user"} + "value": {"<->": "@owner.context.guestUser"} } }, "homedir_path": { diff --git a/ui/inspectors/service.reel/service.js b/ui/inspectors/service.reel/service.js index a1b519357e..41bafb0c05 100644 --- a/ui/inspectors/service.reel/service.js +++ b/ui/inspectors/service.reel/service.js @@ -39,6 +39,11 @@ exports.Service = AbstractInspector.specialize({ if (this.configComponent && typeof this.configComponent.save === 'function') { this.configComponent.save(); } + + if (this.name === 'afp' || this.name === 'smb') { + this.object.config.guest_user = this.context.guestUser.username; + } + this._sectionService.saveService(this.object); } }, diff --git a/ui/inspectors/service.reel/smb-service.reel/smb-service.html b/ui/inspectors/service.reel/smb-service.reel/smb-service.html index be675d4076..77c2320107 100644 --- a/ui/inspectors/service.reel/smb-service.reel/smb-service.html +++ b/ui/inspectors/service.reel/smb-service.reel/smb-service.html @@ -8,6 +8,9 @@ "owner": { "properties": { "element": {"#": "owner"} + }, + "bindings": { + "context.guestUser": {"<-": "@owner.object.guest_user.{username: this}"} } }, "netbiosName": { @@ -107,11 +110,10 @@ "prototype": "ui/controls/search-users.reel", "properties": { "element": {"#": "guestUser"}, - "label": "Guest account", - "valuePath": "username" + "label": "Guest account" }, "bindings": { - "value": {"<->": "@owner.object.guest_user"} + "value": {"<->": "@owner.context.guestUser"} } }, "fileMask": { diff --git a/ui/sections/accounts/inspectors/user.reel/user.js b/ui/sections/accounts/inspectors/user.reel/user.js index c4ec9dbd2f..344bf9c6ab 100644 --- a/ui/sections/accounts/inspectors/user.reel/user.js +++ b/ui/sections/accounts/inspectors/user.reel/user.js @@ -144,8 +144,7 @@ exports.User = AbstractInspector.specialize({ delete this.object.home; } - this.object.group = this.context.primaryGroup ? this.context.primaryGroup : null; - this.object.group = this.object.group && typeof this.object.group === 'object' ? this.object.group.id : this.object.group; + this.object.group = this.context.primaryGroup ? this.context.primaryGroup.id : null; this.object.groups = this.context.secondaryGroups ? this.context.secondaryGroups.map(function (groups) { return groups.id; }, this) : null; diff --git a/ui/sections/storage/inspectors/share.reel/afp-share.reel/afp-share.html b/ui/sections/storage/inspectors/share.reel/afp-share.reel/afp-share.html index fc3abbc016..b50c12490a 100644 --- a/ui/sections/storage/inspectors/share.reel/afp-share.reel/afp-share.html +++ b/ui/sections/storage/inspectors/share.reel/afp-share.reel/afp-share.html @@ -50,8 +50,7 @@ "properties": { "element": {"#": "usersAllow"}, "label": "Users Allowed", - "emptyMessage": "No allowed users added", - "valuePath": "username" + "emptyMessage": "No allowed users added" }, "bindings": { "values": {"<->": "@owner.context.usersAllow"} @@ -62,8 +61,7 @@ "properties": { "element": {"#": "usersDeny"}, "label": "Users Denied", - "emptyMessage": "No users denied", - "valuePath": "username" + "emptyMessage": "No users denied" }, "bindings": { "values": {"<->": "@owner.context.usersDeny"} @@ -74,8 +72,7 @@ "properties": { "element": {"#": "groupsAllow"}, "label": "Groups Allowed", - "emptyMessage": "No allowed groups added", - "valuePath": "name" + "emptyMessage": "No allowed groups added" }, "bindings": { "values": {"<->": "@owner.context.groupsAllow"} @@ -86,8 +83,7 @@ "properties": { "element": {"#": "groupsDeny"}, "label": "Groups Deny", - "emptyMessage": "No groups denied", - "valuePath": "name" + "emptyMessage": "No groups denied" }, "bindings": { "values": {"<->": "@owner.context.groupsDeny"} diff --git a/ui/sections/storage/inspectors/share.reel/nfs-share.reel/nfs-share.html b/ui/sections/storage/inspectors/share.reel/nfs-share.reel/nfs-share.html index 528fe4825e..a96fea9db9 100644 --- a/ui/sections/storage/inspectors/share.reel/nfs-share.reel/nfs-share.html +++ b/ui/sections/storage/inspectors/share.reel/nfs-share.reel/nfs-share.html @@ -7,6 +7,12 @@ "owner": { "properties": { "element": {"#": "owner"} + }, + "bindings": { + "context.maprootUser": {"<-": "@owner.properties.maproot_user.{username: this}"}, + "context.maprootGroup": {"<-": "@owner.properties.maproot_group.{name: this}"}, + "context.mapallGroup": {"<-": "@owner.properties.mapall_group.{name: this}"}, + "context.mapallUser": {"<-": "@owner.properties.mapall_user.{username: this}}"} } }, "readOnly": { @@ -55,46 +61,40 @@ "prototype": "ui/controls/search-users.reel", "properties": { "element": {"#": "maprootUser"}, - "label": "Maproot user", - "valuePath": "username" + "label": "Maproot user" }, "bindings": { - "value": {"<->": "@owner.properties.maproot_user"} + "value": {"<->": "@owner.context.maprootUser"} } }, "maprootGroup": { "prototype": "ui/controls/search-groups.reel", "properties": { "element": {"#": "maprootGroup"}, - "label": "Maproot group", - "valuePath": "name" + "label": "Maproot group" }, "bindings": { - "value": {"<->": "@owner.properties.maproot_group"} + "value": {"<->": "@owner.context.maprootGroup"} } }, "mapallUser": { "prototype": "ui/controls/search-users.reel", "properties": { "element": {"#": "mapallUser"}, - "label": "Mapall user", - "labelPath": "username", - "valuePath": "username" + "label": "Mapall user" }, "bindings": { - "value": {"<->": "@owner.properties.mapall_user"} + "value": {"<->": "@owner.context.mapallUser"} } }, "mapallGroup": { "prototype": "ui/controls/search-groups.reel", "properties": { "element": {"#": "mapallGroup"}, - "label": "Mapall group", - "labelPath": "name", - "valuePath": "name" + "label": "Mapall group" }, "bindings": { - "value": {"<->": "@owner.properties.mapall_group"} + "value": {"<->": "@owner.context.mapallGroup"} } }, "security": { diff --git a/ui/sections/storage/inspectors/share.reel/share-permissions.reel/share-permissions.html b/ui/sections/storage/inspectors/share.reel/share-permissions.reel/share-permissions.html index 3bcbef9b1e..382d4130a7 100644 --- a/ui/sections/storage/inspectors/share.reel/share-permissions.reel/share-permissions.html +++ b/ui/sections/storage/inspectors/share.reel/share-permissions.reel/share-permissions.html @@ -6,6 +6,10 @@ "owner": { "properties": { "element": {"#": "owner"} + }, + "bindings": { + "context.permissionsUser": {"<-": "@owner.object.permissions.user.{username: this}"}, + "context.permissionsGroup": {"<-": "@owner.object.permissions.group.{name: this}"} } }, "permissionsSection": { @@ -30,11 +34,10 @@ "properties": { "element": {"#": "ownerUser"}, "label": "Owner user", - "valuePath": "username", "hasNoneButton": false }, "bindings": { - "value": {"<->": "@owner.object.permissions.user"} + "value": {"<->": "@owner.context.permissionsUser"} } }, "ownerGroup": { @@ -42,11 +45,10 @@ "properties": { "element": {"#": "ownerGroup"}, "label": "Owner group", - "valuePath": "name", "hasNoneButton": false }, "bindings": { - "value": {"<->": "@owner.object.permissions.group"} + "value": {"<->": "@owner.context.permissionsGroup"} } }, "modes": { diff --git a/ui/sections/storage/inspectors/share.reel/share-permissions.reel/share-permissions.js b/ui/sections/storage/inspectors/share.reel/share-permissions.reel/share-permissions.js index ef382e7343..ee6cfb6861 100644 --- a/ui/sections/storage/inspectors/share.reel/share-permissions.reel/share-permissions.js +++ b/ui/sections/storage/inspectors/share.reel/share-permissions.reel/share-permissions.js @@ -1,28 +1,3 @@ -var AbstractInspector = require("ui/abstract/abstract-inspector").AbstractInspector, - Model = require("core/model").Model; +var AbstractInspector = require("ui/abstract/abstract-inspector").AbstractInspector; - var SearchController = function SearchController(service, model) { - this.service = service; - this.model = model - }; - - SearchController.prototype.search = function (value) { - if (this.model === Model.User) { - return this.service.searchUser(value); - } - - return this.service.searchGroup(value); - } - -exports.SharePermissions = AbstractInspector.specialize(/** @lends SharePermissions# */ { - - enterDocument: { - value: function (isFirstTime) { - if (isFirstTime) { - this.groupsSearchController = new SearchController(this._sectionService, Model.Group); - this.usersSearchController = new SearchController(this._sectionService, Model.User); - } - } - } - -}); +exports.SharePermissions = AbstractInspector.specialize(); diff --git a/ui/sections/storage/inspectors/share.reel/share.html b/ui/sections/storage/inspectors/share.reel/share.html index 3788374964..479d452a7c 100644 --- a/ui/sections/storage/inspectors/share.reel/share.html +++ b/ui/sections/storage/inspectors/share.reel/share.html @@ -178,8 +178,9 @@ "element": {"#": "permissions"} }, "bindings": { - "object": {"<->": "@owner.object"}, - "classList.has('hide')": {"<-": "@owner.object.type == 'iscsi'"} + "object": {"<-": "@owner.object"}, + "classList.has('hide')": {"<-": "@owner.object.type == 'iscsi'"}, + "context": {"<-": "@owner.context"} } } } diff --git a/ui/sections/storage/inspectors/share.reel/share.js b/ui/sections/storage/inspectors/share.reel/share.js index 56e76cfa91..f0c60e84e3 100644 --- a/ui/sections/storage/inspectors/share.reel/share.js +++ b/ui/sections/storage/inspectors/share.reel/share.js @@ -171,11 +171,28 @@ exports.Share = AbstractInspector.specialize({ } if (share.properties) { - var properties = share.properties; - properties.groups_allow = this._mapAccountCollection(this.context.groupsAllow, 'name'); - properties.groups_deny = this._mapAccountCollection(this.context.groupsDeny, 'name'); - properties.users_allow = this._mapAccountCollection(this.context.usersAllow, 'username'); - properties.users_deny = this._mapAccountCollection(this.context.usersDeny, 'username'); + var properties = share.properties, + context = this.context, + username = 'username', + name = 'name'; + + properties.groups_allow = this._mapAccountCollection(this.context.groupsAllow, name); + properties.groups_deny = this._mapAccountCollection(this.context.groupsDeny, name); + properties.users_allow = this._mapAccountCollection(this.context.usersAllow, username); + properties.users_deny = this._mapAccountCollection(this.context.usersDeny, username); + + properties.maproot_user = context.maprootUser ? context.maprootUser.username : void 0; + properties.mapall_user = context.mapallUser ? context.mapallUser.username : void 0; + properties.mapall_group = context.mapallGroup ? context.mapallGroup.name : void 0; + properties.maproot_group = context.maprootGroup ? context.maprootGroup.name : void 0; + } + + if (share.permissions) { + var permissions = share.permissions, + context = this.context; + + permissions.user = context.permissionsUser ? context.permissionsUser.username : void 0; + permissions.group = context.permissionsGroup ? context.permissionsGroup.name : void 0; } if (servicePromise) { diff --git a/ui/sections/storage/inspectors/volume-dataset.reel/volume-dataset-permissions.reel/volume-dataset-permissions.html b/ui/sections/storage/inspectors/volume-dataset.reel/volume-dataset-permissions.reel/volume-dataset-permissions.html index 98e2a7bf0e..afaab31b64 100644 --- a/ui/sections/storage/inspectors/volume-dataset.reel/volume-dataset-permissions.reel/volume-dataset-permissions.html +++ b/ui/sections/storage/inspectors/volume-dataset.reel/volume-dataset-permissions.reel/volume-dataset-permissions.html @@ -7,6 +7,10 @@ "owner": { "properties": { "element": {"#": "owner"} + }, + "bindings": { + "context.permissionsUser": {"<-": "@owner.object.permissions.user.{username: this}"}, + "context.permissionsGroup": {"<-": "@owner.object.permissions.group.{name: this}"} } }, "permissionsSection": { @@ -31,22 +35,20 @@ "prototype": "ui/controls/search-users.reel", "properties": { "element": {"#": "ownerUser"}, - "label": "Owner user", - "valuePath": "username" + "label": "Owner user" }, "bindings": { - "value": {"<->": "@owner.object.permissions.user"} + "value": {"<->": "@owner.context.permissionsUser"} } }, "ownerGroup": { "prototype": "ui/controls/search-groups.reel", "properties": { "element": {"#": "ownerGroup"}, - "label": "Owner group", - "valuePath": "name" + "label": "Owner group" }, "bindings": { - "value": {"<->": "@owner.object.permissions.group"} + "value": {"<->": "@owner.context.permissionsGroup"} } }, "modes": { diff --git a/ui/sections/storage/inspectors/volume-dataset.reel/volume-dataset.html b/ui/sections/storage/inspectors/volume-dataset.reel/volume-dataset.html index 65452a3bec..7e12183d71 100644 --- a/ui/sections/storage/inspectors/volume-dataset.reel/volume-dataset.html +++ b/ui/sections/storage/inspectors/volume-dataset.reel/volume-dataset.html @@ -144,7 +144,8 @@ "element": {"#": "permissions"} }, "bindings": { - "object": {"<->": "@owner.object"}, + "object": {"<-": "@owner.object"}, + "context": {"<-": "@owner.context"}, "classList.has('hide')": {"<-": "@owner.object.type != 'FILESYSTEM'"} } }, diff --git a/ui/sections/storage/inspectors/volume-dataset.reel/volume-dataset.js b/ui/sections/storage/inspectors/volume-dataset.reel/volume-dataset.js index 3c9c555487..4b207dc8e0 100644 --- a/ui/sections/storage/inspectors/volume-dataset.reel/volume-dataset.js +++ b/ui/sections/storage/inspectors/volume-dataset.reel/volume-dataset.js @@ -119,6 +119,11 @@ exports.VolumeDataset = AbstractInspector.specialize(/** @lends VolumeDataset# * this.object.permissions = undefined; } + if (this.object.permissions) { + this.object.permissions.user = this.context.permissionsUser.username; + this.object.permissions.group = this.context.permissionsGroup.name; + } + return this.inspector.save.apply(this.inspector, this.object._recursive ? [this.object._recursive] : []); } }