Jump to content
Orkun

How to make a Multi-User-System-Management for Frontend

Recommended Posts

How can i build multi-user-system for the frontend? I have an approach like:

Pagetree:

Login

        -Admin(Admin-Overview)

                  -- Veranstaltungen

                  -- Agenda/Daten

                  -- Multimedia

                  -- Veranstalter

                  -- Import/Export

                  -- Einstellungen

         -user-1(Overview)

                  -- Veranstaltungen

                  -- Agenda/Daten

                  -- Multimedia

                  -- Profil

                  -- Benutzer

         -user-2(Overview)

                  ''

                  ''

         ...

users: user-1, user-2

the users have the role: client

When the successfull login happens:

if($user->isLoggedin()){
	if($user->isSuperuser()){
		$session->redirect("./admin-overview/");
	}
	else if($user->hasRole("client")){	
		$session->redirect("./$user->name/");
	}
}

On the beggining of the _main.php where all the content will be loaded:

To avoid access to the content from another user from the url.

 if($user->isLoggedin()){
    if($page->name != $page404->name){
        if($user->name != $page->rootParent->name){
           $session->redirect("$page404->url");
        }
    }
        
 }

Am I on the right way or is this the completely false?

Can you give me a better approach, a better, safer way to achieve a multi-user-system/management for the frontend??

I must migrate an existing Web-Application that was build with yii to Processwire.

       

Share this post


Link to post
Share on other sites

It depends on the usecase / manageability. Beside of your suggested strategy you could also store all events / agendas / … under a single parent with just an additional pagefield, to link them to the different users. 

Share this post


Link to post
Share on other sites

It depends on the usecase / manageability. Beside of your suggested strategy you could also store all events / agendas / … under a single parent with just an additional pagefield, to link them to the different users. 

Could you explain that further? How should I handle the two interfaces Admin and User?

Do you mean for example:

Login

         -Dashboard

                  -- Veranstaltungen

                  -- Agenda/Daten

                  -- Multimedia

                  -- Veranstalter

                  -- Import/Export

                    -- Einstellungen

When the successfull login happens:

if($user->isLoggedin()){
     $session->redirect("./dashboard/");
	
}

And then for exmplae i create a new event under Events and while creating i can choose from the pagefield which users i want.

Then under the EventIndex-Template i list the events which has the selector like: 

if($user->isLoggedin()){
     $events = $pages->find("template=event, select_users=$user->name");
     
     foreach($events as $event){
      //List the events with template = event and select_user = $user->name
     }
	
}

select_users is the pagefield with the selection of the users.

Share this post


Link to post
Share on other sites

Kinda like that. But as I said it depends on the usecase if such a structure is better (not so much duplication, one page could have multiple users) or worse (harder to overview in the backend). 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By lenoir
      Is it possible to let people edit a page without having to have a user-role?
      My case is the following:
      Visitors fill in a form (Formbuilder) which is saved to pages. They get a confirmation email which could contain a unique editing link. In case they need to update some information, they can click on this link, edit the fields and save. 
      Am I totally off? Is there a better practice? 
    • By DV-JF
      Hi, 
      I'm using this kind of setup (https://processwire.com/blog/posts/language-access-control-and-more-special-permissions/#language-page-edit-permissions) in order to control the page edit permissions. Now I'm wondering if it's possible to hide the "none-ediable" language-tabs instead of striking them through.

      Many greets...
       
    • By Kiwi Chris
      I have a role that has page edit, view, and clone permissions on a specific template.
      If a page using the template is locked by a user in a role with lock/unlock permissions on the template , the only button alongside it in the page tree is view, for users who don't have lock/unlock permissions.
      If however, I also give the role page-lock permission on the template, they then get additional buttons, edit, copy, and unlock.
      I don't actually want to give this role unlock permissions, but I do want the copy (clone) button to display alongside the page in the page tree.
      Elsewhere, I've discussed how I've worked out how to create a hook to unlock the copy, but I want to keep the original page so a user without lock permissions can't unlock from the page tree it to make changes.
      Question: What method should I hook into to intercept any attempt to change the lock status?
    • By AndZyk
      Hello,
      this maybe a simple question, but it bothers me for a while now:
      There used to be a warning, if two or more user try to edit the same page. But ever since AdminThemeUIkit I haven't seen it any more.
      Is this a bug or are there special circumstances under which the warning will be displayed?
      If I am logged-in in the same browser with one default and one privat window, I don't see this warning. But also different browsers on different machines in the same network don't see this warning.
      I was looking for the blog post on which this feature was announced, but couldn't find it anymore.
      We had the case, that two people were writing a text for the same page, but after person A saved the page first, the text of the person B was lost. I know we could have used ProDrafts for this case, but it shouldn't happen in the first place.
      I would appreciate some feedback. 😀
      Regards, Andreas
    • By pwFoo
      Hi,
      I try to add page-edit-own and page-delete-own permissions, but it's strange...
      If a add the custom permissions it looks like both are children of page-edit respectively page-delete. I played with added / revoked permissions, but I can't get it work, that a user of a role just can delete own content.
      First the user can't delete any content and now the user can delete own and foreign pages 🤪
      Is there a tutorial to learn more about the PW permissions?
      Or do I have to rename the permissions to page-own-edit and page-own-delete to be independent from page-edit and page-delete?
×
×
  • Create New...