Track group flags from default groups
This commit is contained in:
1 parent
246c614635
commit
7cf0f552f5
2 files changed
+18
-10
No files matched your search
@@ -194,9 +194,19 @@ class FilebasedGroupManager(GroupManager):
|
||||
tracked_permissions = data.get("tracked", list())
|
||||
|
||||
for key, attributes in groups.items():
|
||||
if key in self._groups and not self._groups[key].is_changable():
|
||||
# group is already there (from the defaults most likely) and may not be changed -> bail
|
||||
continue
|
||||
if key in self._groups:
|
||||
# group is already there (from the defaults most likely)
|
||||
if not self._groups[key].is_changable():
|
||||
# group may not be changed -> bail
|
||||
continue
|
||||
|
||||
removable = self._groups[key].is_removable()
|
||||
changeable = self._groups[key].is_changable()
|
||||
toggleable = self._groups[key].is_toggleable()
|
||||
else:
|
||||
removable = True
|
||||
changeable = True
|
||||
toggleable = True
|
||||
|
||||
permissions = self._to_permissions(*attributes.get("permissions", []))
|
||||
default_permissions = self.default_permissions_for_group(key)
|
||||
@@ -208,9 +218,9 @@ class FilebasedGroupManager(GroupManager):
|
||||
description=attributes.get("description", ""),
|
||||
permissions=permissions,
|
||||
default=attributes.get("default", False),
|
||||
removable=attributes.get("removable",
|
||||
not attributes.get("specialGroup", False)),
|
||||
changeable=attributes.get("changeable", True))
|
||||
removable=removable,
|
||||
changeable=changeable,
|
||||
toggleable=toggleable)
|
||||
except:
|
||||
self._logger.exception("Error while loading groups from file {}".format(self._groupfile))
|
||||
|
||||
@@ -225,9 +235,7 @@ class FilebasedGroupManager(GroupManager):
|
||||
name=group._name,
|
||||
description=group._description,
|
||||
permissions=self._from_permissions(*group._permissions),
|
||||
default=group._default,
|
||||
removable=group.is_removeable(),
|
||||
changeable=group.is_changable()
|
||||
default=group._default
|
||||
)
|
||||
|
||||
data = dict(groups=groups,
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<span data-bind="text: name"></span><br>
|
||||
<small class="muted" data-bind="text: description"></small>
|
||||
</td>
|
||||
<td class="settings_groups_permissions"><span data-bind="text: $root.access.permissionList($data)"></span></td>
|
||||
<td class="settings_groups_permissions"><small><span data-bind="text: $root.access.permissionList($data)"></span></small></td>
|
||||
<td class="settings_groups_actions">
|
||||
<a href="#" class="fa fa-pencil" title="{{ _('Update group') }}" data-bind="enable: changeable, css: {disabled: !changeable}, click: function() { $root.access.groups.showEditGroupDialog($data); }"></a> | <a href="#" class="fa fa-trash-o" title="{{ _('Delete group') }}" data-bind="enable: removable, css: {disabled: !removable}, click: function() { $root.access.groups.removeGroup($data); }"></a>
|
||||
</td>
|
||||
|
||||
Reference in new issue
Block a user