def on_permission_nodes_changed(sender, instance, action, reverse, **kwargs): if reverse: raise M2MReverseNotAllowed if need_rebuild_mapping_node(action): UserGrantedTreeRefreshController.add_need_refresh_by_asset_perm_ids( [instance.id])
def on_permission_assets_changed(sender, instance, action, reverse, pk_set, model, **kwargs): if reverse: raise M2MReverseNotAllowed if not need_rebuild_mapping_node(action): return with tmp_to_org(instance.org): UserGrantedTreeRefreshController.add_need_refresh_by_asset_perm_ids([instance.id])
def on_asset_perm_pre_save(sender, instance, **kwargs): try: old = AssetPermission.objects.get(id=instance.id) if old.is_valid != instance.is_valid: with tmp_to_org(instance.org): UserGrantedTreeRefreshController.add_need_refresh_by_asset_perm_ids([instance.id]) except AssetPermission.DoesNotExist: pass
def on_asset_perm_post_save(sender, instance, created, **kwargs): if not created: return with tmp_to_org(instance.org): UserGrantedTreeRefreshController.add_need_refresh_by_asset_perm_ids([instance.id])
def on_asset_perm_pre_delete(sender, instance, **kwargs): # 授权删除之前,查出所有相关用户 with tmp_to_org(instance.org): UserGrantedTreeRefreshController.add_need_refresh_by_asset_perm_ids([instance.id])
def on_asset_perm_post_save(sender, instance, created, **kwargs): if created: UserGrantedTreeRefreshController.add_need_refresh_by_asset_perm_ids( [instance.id])