Hiding/Showing Columns based on user priviledges access

Hiding/Showing Columns based on user priviledges access

snainkinsnainkin Posts: 2Questions: 0Answers: 0
edited April 2011 in General
Hi,

Can someone please give guidelines on how to use datatables to show or hide columns to different web users of a website based on their privileges.

For example, I have a datatable of 4 columns

name , manager, sales, region

I want to hide the sales columns to all sales users of the system but show the column when managers log into the site.

Can this be succinctly done?

Replies

  • GregPGregP Posts: 500Questions: 10Answers: 0
    It can be, but the responsibility for managing the permissions has to be handed off to the server. Managing that kind of permissions through JavaScript would be fragile at best. The typical scenario is that you will have your authentication method create a session, and then based on the session itself, the server will return a valid data set.

    There are a bunch of ways you could skin this cat, each with their merits. But yes, this could be done. DataTables by itself is not enough, though; you will need to create some server-side logic.
This discussion has been closed.