Is it possible to set privileges on the export to Word, Excel, Printer Friendly, etc, so that only certain users can do so and others cannot?
Privileges on Export
-
- User
- Posts: 187
It worked when I use it to hide a single export option, for example - excel. However, I want to hide excel, word, print, email. I tried repeating the code for each of these exports separately and it did not work. I know I maybe missing the syntax somewhere. How do I adjust the code so that all of the above exports are hidden?
-
- User
- Posts: 187
This is the code. I have also repeated it with the - function Page_Load() - line in every section. If I leave only the first, it works. Once I repeat, the list page is blank and is not even loading the table.
// Page Load event
function Page_Load() {
//echo "Page Load";
if (CurrentUserLevel() == 1) // set your desired user level to hide the export option
{
$item = @$this->ExportOptions->Items["excel"]; // print or excel or word
if ($item)
$item->Visible = FALSE;}
}
{
//echo "Page Load";
if (CurrentUserLevel() == 1) // set your desired user level to hide the export option
{
$item = @$this->ExportOptions->Items["print"]; // print or excel or word
if ($item)
$item->Visible = FALSE;}
}
{
//echo "Page Load";
if (CurrentUserLevel() == 1) // set your desired user level to hide the export option
{
$item = @$this->ExportOptions->Items["word"]; // print or excel or word
if ($item)
$item->Visible = FALSE;}
}
-
- User
- Posts: 1601
Check your extra bracket. It is something like:
if (CurrentUserLevel() == 1)
{
$item = @$this->ExportOptions->Items["word"]; // print or excel or word
if ($item)
$item->Visible = FALSE;
$item = @$this->ExportOptions->Items["print"]; // print or excel or word
if ($item)
$item->Visible = FALSE;
...
}
-
- User
- Posts: 187
See the code below. This is now the problem I am having. According to this code, these export options are only hidden when the CurrentUserLevel is 1. Certainly with the admin I should be able to see all the options. I am however, only seeing excel or whatever option is listed first in the code.
// Page Load event
function Page_Load() {
//echo "Page Load";
if (CurrentUserLevel() == 1) // set your desired user level to hide the export option
$item = @$this->ExportOptions->Items["excel"]; // print or excel or word
if ($item)
$item->Visible = FALSE;
$item = @$this->ExportOptions->Items["word"]; // print or excel or word
if ($item)
$item->Visible = FALSE;
$item = @$this->ExportOptions->Items["print"]; // print or excel or word
if ($item)
$item->Visible = FALSE;
}
-
- User
- Posts: 187
The strangest things are happening and I am beginning to think that this goes beyond the code. See the post just above this. I complained that only excel was showing. I changed in the code word to Word and print to Print, meaning I made the first letter uppercase. All showed but ignored the CurrentUserLevel == 1. Excel remained hidden from that userlevel as excel was still all lowercase. So I made the first letter in excel uppercase. Excel then began to do just what Word and Print was doing, that is, remaining visible when CurrentUserLevel == 1. However as I mentioned in the prior post, if I make them all lower case, only the first export item function as it should - in this case excel.
-
- User
- Posts: 11749
Be careful! :)
That code is only for hiding the export icons, but if your users obviously know about the export link, then they are still able to export your data by typing the URL from their browser address.
For example:
h++p://www.yourwebapp.com/customerslist.php?export=print
or
h++p://www.yourwebapp.com/customerslist.php?export=excel