Implementing row-level security

Implementing row-level security

atcclearsatcclears Posts: 24Questions: 7Answers: 0

Do you have a suggestion on how one might implement row-level security in DataTables and Editor?

For example, assume a table of Notes. In the Ajax load I can provide a hidden attribute per row that indicates if the user can edit or delete that row.

If the user cannot edit or delete that row, I'd like to be able to NOT enable the Edit and Delete buttons in Editor if they highlight that row.

Oh, I'm also running with "so" (and not "os") so there is no ability to select multiple rows.

Any ideas are appreciated, and I'd be happy to post a working solution.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    Answer ✓

    I feel it is a little hacky, but you could use preOpen to check and see what the row's data is and return false to cancel the form's display if it doesn't match the editing requirements.

    I think ultimately the best fix would probably be simply not to call the edit() method on click of the buttons. That would involve providing your own fnClick function for the buttons that will call the Editor API.

    Regards,
    Allan

This discussion has been closed.