carcleo's avatar

Admin and SuperAdmin. How to do?

I would like of explanation about of how create the login (UAC) with

Admin and SuperAdmin and Usernormal

Admin and SuperAdmin use the same environment

/admim
/usernormal

or its separade?

/admin
/superadmin
/usernormal

The SuperAdmin do everything that Admin do more new Admins commons and also register new admins /usernormal

0 likes
16 replies
carcleo's avatar

@martinbean Ok, i will go waith for another idea, but thank you. you do not understood my doubt

bmckay959's avatar

Hey @carcleo, what @martinbean suggested is the 'standard' way of doing this type of thing for 90% of use cases. Can you explain the difference of why this won't work for your case?

1 like
Tray2's avatar

It depends a little on the use case, are we talking just three roles?

  • User
  • Admin
  • Superadmin

Then I probably wouldn't use roles per se, I would most likely just create tables that contains the user ids of the admins and super admins. However if this is going to grow with additional types of users then roles is the way to go.

carcleo's avatar

@Tray2 in this true, yes, there is more uses cases. But i is fixeding my attention at admim ambient (admin area) with admin e superadmin users.

For each can have your separed area

/admim
/superadmin

ou both at the same area?

Tray2's avatar

@carcleo I would just to /dashboard regardless of the user type.

1 like
jlrdw's avatar

Use authentication for login.

Use authorization to determine what a logged in user can or cannot do.

An admin is a user. A superadmin (???) is a user. A janitor is a user. A person using the site is a user. The owner (head m- in charge) is a user.

I have had apps where even a big chief admin can't mess with certain accounting data. View yes, modify no.

I suggest you forget things like "super admin", and deal with what a particular user with their role can or cannot do.

Suggestions only.

carcleo's avatar

@jlrdw Then, i am entering to worl Laravel now, so being, everything is new to me yeat. I did so :

/admin
/magazine
/client
/......

But it apear that this model did changes. Correct?

carcleo's avatar

People, i think that you all not understand.

I wnat ideas about routes.

/superdmin
/admim 
/usernormal

or

/admim 
/usernormal

The Super would have a ambient only for his or he can use the /admin same?

Go3shom's avatar

@carcleo I believe that you don't need to separate routes for SuperAdmin and Admin; just differentiate between roles by middleware, gate, or policy

1 like
jlrdw's avatar

@carcleo I would highly recommend that you take the 30 days to learn laravel course.It is free. It will give you an idea of how authorization works.

1 like
Snapey's avatar

@carcleo you keep using the word 'ambient' but this is not correct in this context, so we are struggling to understand what you mean.

1 like
jlrdw's avatar

@Snapey I think he means make it available anywhere.

@carcleo if so you have $user = auth()->user(); helper for that.

And

$user = auth('admin')->user();

If you have that guard.

Please or to participate in this conversation.