Move to numeric acl types

fixes #297

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2017-12-05 11:02:46 +01:00
committed by Julius Härtl
parent ef64dfc5a2
commit a8aab8d049
4 changed files with 18 additions and 35 deletions

View File

@@ -67,32 +67,4 @@ class Acl extends RelationalEntity {
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;
}
}