Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Simon Dingley 1474 posts 3431 karma points c-trib
    Jan 04, 2019 @ 11:42
    Simon Dingley
    1

    Disable Bulk Operations in Members List View

    My question is in relation to another problem I needed to tackle and which is covered in the thread Disable Save Button in Members Area for Users that are not in a given UserGroup

    The solution in the other thread works great for the editor view however it is still possible for users to select and delete members in the list view. This is my current struggle! I somehow need to hook into the config for the view and disable the "allowBulkOperations" setting for users not in the required user group.

    If anyone can offer any insight or alternative solution I'd appreciate some pointers because as usual I'm lost in the angular. The previous method of using interceptors doesn't seem to be an option as what I need seems to be buried within the umb-editor-sub-header__section directive but I'm not sure how that is populated. If I remove the entire directive it prevents users from searching.

    Thanks in advance.

  • Joe 32 posts 136 karma points
    Oct 11, 2019 @ 06:24
    Joe
    0

    My case is simpler as member bulk deletion is usually not a good action, so I just unchecked "Allow Bulk Delete" in Admin Panel/Developer/Data Type/List View - Members.

    For your case, I suggest overriding Umbraco.Web/Editors/MemberController.cs --> GetListNodeDisplay(), and just replace the js resource API path with your version.

    If you dig into the HTTP requests and GitHub code, you'll find that you need to modify the Tab.Properties in the returned model MemberListDisplay

    Look into the json response below of the GetListNodeDisplay(), and you will see two sets of allowBulkDelete in bulkActionPermissions. They are your targets to override.

    {
            "contentTypeName": "Merchello Customer",
            "isContainer": true,
            "notifications": [],
            "ModelState": {},
            "tabs": [
                {
                    "id": 1,
                    "active": true,
                    "label": "Child items",
                    "alias": "umbContainerView",
                    "properties": [
                        {
                            "label": "",
                            "description": null,
                            "view": "listview",
                            "config": {
                                "pageSize": "10",
                                "displayAtTabNumber": "1",
                                "orderBy": "username",
                                "orderDirection": "asc",
                                "includeProperties": [
                                    {
                                        "alias": "username",
                                        "isSystem": 1
                                    },
                                    {
                                        "alias": "email",
                                        "isSystem": 1
                                    },
                                    {
                                        "alias": "updateDate",
                                        "header": "Last edited",
                                        "isSystem": 1
                                    }
                                ],
                                "layouts": [
                                    {
                                        "name": "List",
                                        "path": "views/propertyeditors/listview/layouts/list/list.html",
                                        "icon": "icon-list",
                                        "isSystem": 1,
                                        "selected": true
                                    },
                                    {
                                        "name": "Grid",
                                        "path": "views/propertyeditors/listview/layouts/grid/grid.html",
                                        "icon": "icon-thumbnails-small",
                                        "isSystem": 1,
                                        "selected": true
                                    }
                                ],
                                "bulkActionPermissions": {
                                    "allowBulkPublish": true,
                                    "allowBulkUnpublish": true,
                                    "allowBulkCopy": true,
                                    "allowBulkMove": false,
                                    "allowBulkDelete": true
                                },
                                "entityType": "member"
                            },
                            "hideLabel": true,
                            "validation": {
                                "mandatory": false,
                                "pattern": null
                            },
                            "readonly": false,
                            "id": 0,
                            "dataTypeId": null,
                            "value": null,
                            "alias": "_umb_containerView",
                            "editor": null,
                            "isSensitive": false
                        }
                    ]
                }
            ],
            "properties": [
                {
                    "label": "",
                    "description": null,
                    "view": "listview",
                    "config": {
                        "pageSize": "10",
                        "displayAtTabNumber": "1",
                        "orderBy": "username",
                        "orderDirection": "asc",
                        "includeProperties": [
                            {
                                "alias": "username",
                                "isSystem": 1
                            },
                            {
                                "alias": "email",
                                "isSystem": 1
                            },
                            {
                                "alias": "updateDate",
                                "header": "Last edited",
                                "isSystem": 1
                            }
                        ],
                        "layouts": [
                            {
                                "name": "List",
                                "path": "views/propertyeditors/listview/layouts/list/list.html",
                                "icon": "icon-list",
                                "isSystem": 1,
                                "selected": true
                            },
                            {
                                "name": "Grid",
                                "path": "views/propertyeditors/listview/layouts/grid/grid.html",
                                "icon": "icon-thumbnails-small",
                                "isSystem": 1,
                                "selected": true
                            }
                        ],
                        "bulkActionPermissions": {
                            "allowBulkPublish": true,
                            "allowBulkUnpublish": true,
                            "allowBulkCopy": true,
                            "allowBulkMove": false,
                            "allowBulkDelete": true
                        },
                        "entityType": "member"
                    },
                    "hideLabel": true,
                    "validation": {
                        "mandatory": false,
                        "pattern": null
                    },
                    "readonly": false,
                    "id": 0,
                    "dataTypeId": null,
                    "value": null,
                    "alias": "_umb_containerView",
                    "editor": null,
                    "isSensitive": false
                }
            ],
            "updateDate": "0001-01-01 00:00:00",
            "createDate": "0001-01-01 00:00:00",
            "published": false,
            "hasPublishedVersion": false,
            "owner": null,
            "updater": null,
            "contentTypeAlias": "merchelloCustomer",
            "sortOrder": 0,
            "name": "Merchello Customer",
            "id": "merchelloCustomer",
            "udi": null,
            "icon": null,
            "trashed": false,
            "key": "00000000000000000000000000000000",
            "parentId": -1,
            "alias": null,
            "path": "-1,merchelloCustomer",
            "metaData": {}
    }
    
Please Sign in or register to post replies

Write your reply to:

Draft