L
L
Leonid Gorshkov2019-03-01 12:47:01
MODX
Leonid Gorshkov, 2019-03-01 12:47:01

How to find out in modx whether the user group (user) has access to the resource (by id)?

Good afternoon, how to check access to a resource by id?
(I use the Login plugin)
In resources, it is usually set which user groups have access to it, and if they do not have them, it throws a 404.

spoiler
5c78feb332aae045199164.jpeg5c78feda19361879910068.jpeg

But I would like to write a snippet (or use a ready-made bike) to find out if the user has access by id.
How to achieve this?
Found something like:
No
Yes
But it seems to just check if you are logged in or not.
You need something like "If the user has access to the resource with id 25, then return the text. If it does not have access, then return another text2" ))

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Tarasov, 2019-03-01
@Synacs-U

It would be more flexible and easier, as for me, to write a snippet that receives the resource ID parameter as input and checks whether the current user is allowed access to such a resource.
You can read about the snippet code on the MODX forum for example.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question