Permission needed for user to get a certificate

Created on 19 June 2023, about 1 year ago
Updated 27 June 2023, about 1 year ago

Problem/Motivation

I have set up the module with Certificate Mapping on a content type. We are doing checks internally to know when user is viewing this content type to know if they should be able to view the certificate. When logged in as an admin everything works fine, but if you're a normal logged-in user, when you go to the certificate page / print page you get access denied. In messing with permissions, I have given logged-in users every permission I could find related to the certificate module and still get that error. If I give the user the permission to bypass security on Content Types, I can access the certificate.

Hopefully I'm just missing something?

πŸ’¬ Support request
Status

Active

Version

4.0

Component

Documentation

Created by

πŸ‡ΊπŸ‡ΈUnited States josh.fabean

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @josh.fabean
  • πŸ‡ΊπŸ‡ΈUnited States josh.fabean

    After messing with this more, I was able to get it to work, but in a way that seems like I'm opening myself up to permissions issues by changing a permission check. In CertificateController:accessTab it returns the access checked of $entity->access('certificate', $requestedUser, TRUE);. The first param passed in is the operation you're checking against, but there is no "certificate" operation for nodes. I changed it to, $entity->access('view', $requestedUser, TRUE); as there is a view permission on nodes.

    With this change, I still can only view my certificate if I'm logged in and have a Certificate Snapshot created for this use. If I go to view it logged in but a user who doesn't have an existing Certificate Snapshot I get a PHP error on trying to render it when nothing exists. For me this will the issue as I'm not displaying buttons to view cert if you don't have one generated, but I get this work around is not great as now it's trying to print it for everyone when they really shouldn't have one.

    If someone has ideas, I'd gladly work on getting a better real patch working, but I did want to update this with steps in case others have a similar issue.

Production build 0.69.0 2024