Jump to content

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


Orkun
 Share

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.

       

Link to comment
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.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...