As you know, in VP, when a user has read access to a teamwork project, they automatically have read access to all diagrams within that project.
I’m looking for a way to restrict access to certain parts of a project — for example, a specific diagram — even if the user has read access to the overall project.
Is there any way to handle this via the API or a plugin? For instance, when a user tries to open a diagram, the plugin could block access if the user doesn’t have permission for that specific diagram.
I’m sorry that our product do not have this capability. We have the assumption that once user gain access to a project then he can see all content inside. For your case you can partition your models/diagrams into different projects, and link them up using the Project Reference feature. In this case you can use the project access permission in repository (Teamwork Server or VP Online) to control which content the user can access. Details about the use of project reference can be found at 1. Project Reference - Visual Paradigm Community Circle
Does the VP application support any kind of event handling within a plugin? Specifically, I’m referring to the diagram opening event.
I’m considering developing a plugin that listens to VP events (if that’s possible). The idea is that whenever a diagram opening event is triggered, the plugin should check the user’s access level based on my own logic. If the user does not have the proper access rights, the plugin should prevent the diagram from opening and close it immediately.
Is this possible? If so, I’d greatly appreciate it if you could provide a sample code snippet or refer me to the relevant section of the VP documentation.
You can reference to the article below about the events that plugin can capture. But please not that the diagram is only the visual presentation of the models, even user cannot open the diagram but he can still able to access the models being used in that diagram from the Model Explorer/Diagram Navigator tree.