Fork me on GitHub

module content owner permissions  Bottom

  • Marry Christmas and Happy new year to everybody

    Hi all
    I'm writing CV module (for now admin can submit, edit basic CV data).
    My question is how to let users edit only their own CV (items submeted from user but not from other users)
    I can do check
    if $uid==$cr_uid but is there a better way to do this?
    I dont want to give EDIT permission globally . This will let user to edit other user's CV data



    edited by: shoshia, datetimebrief
  • That's always how I've done it, check if they have general permission to edit (which in your case will be the same as add), if so, check the creator id against the user id.

    --
    Home Page | Find on Facebook | Follow on Twitter
  • Thanks a lot.
    But can this cause security problems?
    I mean if I have a edit acces and pass other user's uid instead of main?
    of cours i can log lasttime edited users id and see if i get this kind of "smart" user but it will not help if large amount of data will be corrupted
  • No, there should be no risk because you shouldn't be passing data around in any manner that can be compromised. IN the display template, you show an edit link only if the logged in user = the record owner's id. If they're different no display. In the code for editing the info, you check in the API that the owner id & logged in user id are the same. There should be no easy way to get around it.

    --
    Home Page | Find on Facebook | Follow on Twitter

This list is based on users active over the last 60 minutes.