Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

**id_only** allows to modify others id via url :( #15

Open
mcbcrud opened this issue Oct 25, 2018 · 4 comments
Open

**id_only** allows to modify others id via url :( #15

mcbcrud opened this issue Oct 25, 2018 · 4 comments

Comments

@mcbcrud
Copy link

mcbcrud commented Oct 25, 2018

First of all congratulations for this great project, it has been very useful for me thanks!! ... the problem occurs when entering the table crud_users with a user with permission ID_ONLY, when entering edit, it is possible to modify the url with the id of another user and change the password ....
screenshot_1


screenshot_2


screenshot_3

any suggestions????
greetings from Chile!!!

@portapipe
Copy link
Owner

portapipe commented Oct 25, 2018

Hi and thanks :)

You can use the getState() event to catch where the user is into, then you can use the
$crud = $this->login_model->check($crud,"author");
in the crud part to avoid user to see other user's profile.

With $crud->getState()=="edit" you can make a database query to see if the permission is "IDOnly" for that page like
extractPermission("ID",false,"crud_users")
or with the more simple
IDOnly("crud_users")
and then you can redirect the user if the getStateInfo()->primary_key is different from the logged user's id.

I think is simple but a little tricky, but you can take a look at the wiki HERE and find YOUR better way to create it. I've give you more than 1 way to make it so I'm sure you'll find how to make it ;)

BTW! I suggest you to take the crud_users page just for you and create a new page for them, just to avoid to cut you off from the user management.

@mcbcrud
Copy link
Author

mcbcrud commented Oct 27, 2018

the only way you can do it:

if($crud->getState()=="edit"){
$segmentsCount = $this->uri->total_segments();
$itemID = intval($this->uri->segment($segmentsCount));
if($itemID!=$this->idUsuario) redirect("/login/logout");
}

getStateInfo()->primary_key //Not work!!!

regards!!!

@portapipe
Copy link
Owner

Well make a var_dump($crud->getStateInfo()); and you'll see.
Here the docs

@mcbcrud
Copy link
Author

mcbcrud commented Oct 27, 2018

Yes, today it worked for me, yesterday I did not x)
thanks!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants