📜 ⬆️ ⬇️

Personal access to files on the site made by MODx

Task: There is a CMS MODx Revolution. Among all registered users on the site there is a user named 13335. For him, a file is downloaded that no one else should see but himself.

Decision:

1) Create a resource group.

Security -> Resource Groups -> Create Resource Group.
Specify the name: 13335;
Default contexts web;
Put the checkbox "Create a parallel group of users." Obviously what will happen.
Then, from the right column of all our resources, select those that the user should see and drag with the mouse into the left column, into our new resource group.
')
2) Create a resource 13335 inside your personal account:

For example:



Enter the content of the resource

[[!FileLister? &path=`assets/files/patch/13335`]]

Indicating that there will be a link to the folder. In it just the file we need.
In the tab “Resource groups” add the resource group “13335”.

3) Create a user group.

Security -> Access Control -> User Group. Since we put the checkbox "Create a parallel group of users", then we already have it. It remains to check and fill out the field. Call the context menu, select "Edit user group".

Tab "General Information".
Name: 13335;
Parent group: 0;
Panel: Default.

Bookmark "Users".
Add to the group an existing user 13335.
Specify role - Member-9999

Tab "Access to contexts."
Add a new context:
Context: web.
Minimum role: Member - 9999;
Access Policy: Context.

“Access to resource groups” tab.
Add the already created resource group 13335.

In theory, everything.

I read and tried to understand all of this , and this one was written by Shpak on web development using MODx tools. On the basis of what I read, I did everything at random and trial and error.

Source: https://habr.com/ru/post/186836/


All Articles