Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New routes for layer permissions bundle #973

Merged
merged 6 commits into from
Jun 22, 2023

Conversation

ZakarFin
Copy link
Member

@ZakarFin ZakarFin commented Jun 16, 2023

LayerPermissionHandler would be replacement for GetPermissionsLayerHandlers and SaveLayerPermissionHandler. Also GetAllRolesHandler can be removed since the newer ManageRoles does basically the same thing.

The response from LayerPermissionHandler for GET request would be layers and their permissions for each role (that have permissions):

{
    "names": {
        "VIEW_PUBLISHED": "Katseluoikeus",
        "EDIT_LAYER_CONTENT": "Muokkaa tasoa",
        "DOWNLOAD": "Latausoikeus",
        "PUBLISH": "Julkaisuoikeus",
        "VIEW_LAYER": "Listausoikeus"
    },
    "layers": [{
            "id": 234,
            "name": "Layer name 1",
            "permissions": {
                "12": [
                    "VIEW_PUBLISHED",
                    "DOWNLOAD",
                    "VIEW_LAYER"
                ],
                "43": [
                    "VIEW_PUBLISHED",
                    "DOWNLOAD",
                    "VIEW_LAYER"
                ],
                "23": [
                    "VIEW_PUBLISHED",
                    "DOWNLOAD",
                    "PUBLISH",
                    "VIEW_LAYER"
                ]
            }
        },
        {
            "id": 76,
            "name": "Layer name 35",
            "permissions": {
                "12": [
                    "VIEW_PUBLISHED",
                    "DOWNLOAD",
                    "VIEW_LAYER"
                ],
                "43": [
                    "VIEW_PUBLISHED",
                    "DOWNLOAD",
                    "PUBLISH",
                    "VIEW_LAYER"
                ],
                "23": [
                    "VIEW_PUBLISHED",
                    "DOWNLOAD",
                    "PUBLISH",
                    "VIEW_LAYER"
                ]
            }
    }]
}

Where "12", "43" and "23" are role ids corresponding to roles like "Guest" or "User" or "Admin" and the array lists permissions that the role has.

Sending id-parameter with a layer id can be used to get permissions for single layer.

@ZakarFin
Copy link
Member Author

Might need to tune the JSON format still. This is about 8megs worth of json with ~2500 layers and ~20 roles/5 permission types.

@ZakarFin
Copy link
Member Author

After 9023a50 the same result is ~660kb which seems more doable.

@ZakarFin ZakarFin marked this pull request as ready for review June 22, 2023 12:22
@ZakarFin ZakarFin added this to the 2.12.0 milestone Jun 22, 2023
@ZakarFin
Copy link
Member Author

I'll merge this for now. The saving functionality still need to be added to this route (based on SaveLayerPermissions, but we should take a look at what format we want to use for the payload etc).

@ZakarFin ZakarFin merged commit f3513e6 into oskariorg:develop Jun 22, 2023
@ZakarFin ZakarFin deleted the permission-admin branch June 22, 2023 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant