appears to be a bug with single menu item

larryk

Well-known member
Hi, here is the situation:

1) a certain user group can ONLY see 1 menu option (on the left menu). Call it ABC_Menu.
this option has read permissions.

2) With number 1 above done, (BY IT SELF), it does not show up????
3) ABC_Menu is actually a View (not a table).

4) IF I display another table (for example, for the same group, I also turn on read permission for another table).

THEN both menu options display.

Has anyone else noticed that? How to only have a single menu item for a view page?

Thanks


Your current DaDaBIK version
You are using DaDaBIK version 10.2-Manarola enterprise, installed on 08-18-2020
PHP Version: 7.2.34
mysql version: 5.5.65-MariaDB
Web server: Apache
 

eugenio

Administrator
Staff member
That's not a bug, you have probably set

$dont_show_menu_if_only_one_item = 1;

in config.php

Best,
 

larryk

Well-known member
Something not correct?

I have a Group that only have a single left menu item. I get this

Unexpected error, this page is not enabled or the current user doesn't have the permissions to view it.



I added this:
$dont_show_menu_if_only_one_item = 1;

and tried this:
$dont_show_menu_if_only_one_item = 0;

The error happens on both?

PS. that config variable was not already existing? Is that the right spelling?
 

larryk

Well-known member
FYI.

I have many pages, but for Group B, I only have 2 menus to show (menu1 and menu2). IF both have permissions to display for Group B, then both menus display.


BUT I only need Menu2 to display.

SO if I turn permission OFF on menu1 page, you get the error and nothing shows up?
If I turn ON permission on Menu2, both show up?
 

eugenio

Administrator
Staff member
This parameter
$dont_show_menu_if_only_one_item

is not related to the message you got, "Unexpected error, this page is not enabled or the current user doesn't have the permissions to view it." means exactly what it says, the custom page you are trying to see is either:
- not enabeld or
- the group doesn't have the permissions to see it

Best,
 

larryk

Well-known member
THanks... but I must be missing something?


USER 123 is in GROUP staff.

On PAGES, the view StaffPage is installed and enabled.

On PERMISSIONS, the view StaffPage for GROUP staff has READ and EDIT set to yes.

When logging in as USER 123, the message is shown:

Unexpected error, this page is not enabled or the current user doesn't have the permissions to view it.


--- I don't understand what else to check?
thanks
 

larryk

Well-known member
ahhh...

more details:

for ADMIN, I show a custom page, as the top menu item.
for STAFF, they do not see this customer page BUT the url (after logging) is trying to display it.

that is the issue. for some reason, Dadabik is trying to display to STAFF users the custom page of ADMIN????

ADMIN login goes here: /index.php?function=show_static_page&id_static_page=3
STAFF should NOT go to that url, but it is? that is why the permission error is being displayed.

why is that happening?

NOTE: the custom page has STAFF permission set to NO

thanks
 

larryk

Well-known member
how to force Dadabik to not show a custom page for a certain group when the permission is already set to NO for the group?
 

eugenio

Administrator
Staff member
Hello,
I think what is happening is that you are trying to disable the homepage of the application to some groups, if you set a page as "homepage", DaDaBIK tries to go there when you log in and if the current user doesn't have the correct permissions, you get an error.

Best,
 

larryk

Well-known member
uhmmm...

this is my goal:

GROUP A = they see the menu and have a custom page as 1 page displayed.

GROUP B = they don't need a menu and only see a view table as their only page. Basically, they only have 1 page to see.

so what is the solution? how to accomplish the above Groups without error?

thanks


PS. when you say, "if you set a page as "homepage"... is there a setting? Or do you just mean the 1st menu choice is the home page?
 

larryk

Well-known member
if you are following... here is the answer:

make a custom home page that the only purpose is to redirect to another page.
meaning, Dadabik isn't designed to allow multiple home pages for different groups.

So have a custom page that does it for you.
FYI. the "home page" check box is on the Pages tab for custom pages.


this is my home page that redirects based on group:

<?php
// don't delete this line, this must be the first line of your code
if(!defined('custom_page_from_inclusion')) { die(); }

global $current_id_group;

if ($current_id_group == 2){
header('Location:'.$dadabik_main_file.'?function=search&tablename=my_cust_view');
exit;
} else {
header('Location:'.$dadabik_main_file.'?function=show_static_page&id_static_page=3');
exit;
}
 

eugenio

Administrator
Staff member
Ok, it was an homepage then. Yes, that is a correct solution to have different homepages (including both custom pages and table pages) for different groups.


Best,
 
Top