Move to numeric acl types
fixes #297 Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
committed by
Julius Härtl
parent
ef64dfc5a2
commit
a8aab8d049
@@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** global: oc_defaults */
|
/** global: oc_defaults, OC */
|
||||||
app.controller('BoardController', function ($rootScope, $scope, $stateParams, StatusService, BoardService, StackService, CardService, LabelService, $state, $transitions, $filter) {
|
app.controller('BoardController', function ($rootScope, $scope, $stateParams, StatusService, BoardService, StackService, CardService, LabelService, $state, $transitions, $filter) {
|
||||||
|
|
||||||
$scope.sidebar = $rootScope.sidebar;
|
$scope.sidebar = $rootScope.sidebar;
|
||||||
@@ -32,6 +32,7 @@ app.controller('BoardController', function ($rootScope, $scope, $stateParams, St
|
|||||||
$scope.newLabel = {};
|
$scope.newLabel = {};
|
||||||
$scope.status.boardtab = $stateParams.detailTab;
|
$scope.status.boardtab = $stateParams.detailTab;
|
||||||
|
|
||||||
|
$scope.OC = OC;
|
||||||
$scope.stackservice = StackService;
|
$scope.stackservice = StackService;
|
||||||
$scope.boardservice = BoardService;
|
$scope.boardservice = BoardService;
|
||||||
$scope.cardservice = CardService;
|
$scope.cardservice = CardService;
|
||||||
@@ -208,6 +209,16 @@ app.controller('BoardController', function ($rootScope, $scope, $stateParams, St
|
|||||||
BoardService.updateAcl(acl);
|
BoardService.updateAcl(acl);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.aclTypeString = function (acl) {
|
||||||
|
switch (acl.type) {
|
||||||
|
case OC.Share.SHARE_TYPE_USER:
|
||||||
|
return 'user';
|
||||||
|
case OC.Share.SHARE_TYPE_GROUP:
|
||||||
|
return 'group';
|
||||||
|
default:
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// settings for card sorting
|
// settings for card sorting
|
||||||
$scope.sortOptions = {
|
$scope.sortOptions = {
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ app.factory('BoardService', function (ApiService, $http, $q) {
|
|||||||
|
|
||||||
// filter out everyone who is already in the share list
|
// filter out everyone who is already in the share list
|
||||||
angular.forEach(users, function (item) {
|
angular.forEach(users, function (item) {
|
||||||
var acl = self.generateAcl('user', item);
|
var acl = self.generateAcl(OC.Share.SHARE_TYPE_USER, item);
|
||||||
var exists = false;
|
var exists = false;
|
||||||
angular.forEach(self.getCurrent().acl, function (acl) {
|
angular.forEach(self.getCurrent().acl, function (acl) {
|
||||||
if (acl.participant.primaryKey === item.value.shareWith) {
|
if (acl.participant.primaryKey === item.value.shareWith) {
|
||||||
@@ -94,7 +94,7 @@ app.factory('BoardService', function (ApiService, $http, $q) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
angular.forEach(groups, function (item) {
|
angular.forEach(groups, function (item) {
|
||||||
var acl = self.generateAcl('group', item);
|
var acl = self.generateAcl(OC.Share.SHARE_TYPE_GROUP, item);
|
||||||
var exists = false;
|
var exists = false;
|
||||||
angular.forEach(self.getCurrent().acl, function (acl) {
|
angular.forEach(self.getCurrent().acl, function (acl) {
|
||||||
if (acl.participant.primaryKey === item.value.shareWith) {
|
if (acl.participant.primaryKey === item.value.shareWith) {
|
||||||
|
|||||||
@@ -67,32 +67,4 @@ class Acl extends RelationalEntity {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function jsonSerialize() {
|
|
||||||
$json = parent::jsonSerialize();
|
|
||||||
$json['type'] = $this->getTypeString();
|
|
||||||
return $json;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getTypeString() {
|
|
||||||
if ($this->type === self::PERMISSION_TYPE_GROUP) {
|
|
||||||
return 'group';
|
|
||||||
}
|
|
||||||
return 'user';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setType($type) {
|
|
||||||
if (is_numeric($type)) {
|
|
||||||
parent::setType($type);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// FIXME: Remove when all javascript uses numeric types
|
|
||||||
if ($type === 'group' || $type === '1') {
|
|
||||||
$typeInt = self::PERMISSION_TYPE_GROUP;
|
|
||||||
} else {
|
|
||||||
$typeInt = self::PERMISSION_TYPE_USER;
|
|
||||||
}
|
|
||||||
$this->markFieldUpdated('type');
|
|
||||||
$this->type = $typeInt;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -25,10 +25,10 @@
|
|||||||
placeholder="<?php p($l->t('Select users or groups to share with')); ?>"
|
placeholder="<?php p($l->t('Select users or groups to share with')); ?>"
|
||||||
on-select="aclAdd(status.addSharee)" search-enabled="true">
|
on-select="aclAdd(status.addSharee)" search-enabled="true">
|
||||||
<ui-select-match placeholder="<?php p($l->t('Select users or groups to share with')); ?>">
|
<ui-select-match placeholder="<?php p($l->t('Select users or groups to share with')); ?>">
|
||||||
<span><i class="icon icon-{{$item.type}}"></i> {{ $item.participant.displayname }}</span>
|
<span><i class="icon icon-{{aclTypeString($item)}}"></i> {{ $item.participant.displayname }}</span>
|
||||||
</ui-select-match>
|
</ui-select-match>
|
||||||
<ui-select-choices refresh="searchForUser($select.search)" refresh-delay="0" repeat="sharee in boardservice.sharees">
|
<ui-select-choices refresh="searchForUser($select.search)" refresh-delay="0" repeat="sharee in boardservice.sharees">
|
||||||
<span><i class="icon icon-{{sharee.type}}"></i> {{ sharee.participant.displayname }}</span>
|
<span><i class="icon icon-{{aclTypeString(sharee)}}"></i> {{ sharee.participant.displayname }}</span>
|
||||||
</ui-select-choices>
|
</ui-select-choices>
|
||||||
<ui-select-no-choice>
|
<ui-select-no-choice>
|
||||||
<?php p($l->t('No matching user or group found.')); ?>
|
<?php p($l->t('No matching user or group found.')); ?>
|
||||||
@@ -45,8 +45,8 @@
|
|||||||
</li>
|
</li>
|
||||||
<li ng-repeat="acl in boardservice.getCurrent().acl track by $index">
|
<li ng-repeat="acl in boardservice.getCurrent().acl track by $index">
|
||||||
<span class="icon-loading-small" style="display:none;" title="<?php p($l->t('Loading')); ?>"></span>
|
<span class="icon-loading-small" style="display:none;" title="<?php p($l->t('Loading')); ?>"></span>
|
||||||
<div class="avatardiv" avatar displayname="{{ acl.participant.uid }}" ng-if="acl.type=='user'"></div>
|
<div class="avatardiv" avatar displayname="{{ acl.participant.uid }}" ng-if="acl.type==OC.Share.SHARE_TYPE_USER"></div>
|
||||||
<div class="avatardiv" ng-if="acl.type=='group'"><i class="icon icon-{{acl.type}}" title="<?php p($l->t('Access for')); ?> {{acl.type}}"></i></div>
|
<div class="avatardiv" ng-if="acl.type==OC.Share.SHARE_TYPE_GROUP"><i class="icon icon-{{aclTypeString(acl)}}" title="<?php p($l->t('Access for')); ?> {{aclTypeString(acl)}}"></i></div>
|
||||||
|
|
||||||
<span class="has-tooltip username">
|
<span class="has-tooltip username">
|
||||||
{{ acl.participant.displayname }}
|
{{ acl.participant.displayname }}
|
||||||
|
|||||||
Reference in New Issue
Block a user