Exemplo n.º 1
0
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])
Exemplo n.º 2
0
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])
Exemplo n.º 3
0
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
Exemplo n.º 4
0
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])
Exemplo n.º 5
0
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])
Exemplo n.º 6
0
def on_asset_perm_post_save(sender, instance, created, **kwargs):
    if created:
        UserGrantedTreeRefreshController.add_need_refresh_by_asset_perm_ids(
            [instance.id])