webcalendar icon indicating copy to clipboard operation
webcalendar copied to clipboard

Not authorized to edit Layers even as Admin

Open marcnyc2001 opened this issue 1 year ago • 19 comments

Hello, I am having an issue with LAYERS. I am the ADMIN but when I click on ADMIN>Layers I get a message that says: "!!!You are not authorized" and I am unable to add or even view the current layers.

Can somebody help me get access to this feature, please? Thank you

marcnyc2001 avatar May 22 '23 20:05 marcnyc2001

I actually discovered this same issue this morning. I tried other admin accounts and got the same message, effectively removing our ability to use layers at all.

Tharrington86 avatar Sep 19 '23 12:09 Tharrington86

Have you found a solution?

marcnyc2001 avatar Sep 24 '23 14:09 marcnyc2001

What version are you using. I am unable to reproduce this in v1.9.9.

craigk5n avatar Sep 25 '23 20:09 craigk5n

1.2.7

marcnyc2001 avatar Sep 25 '23 21:09 marcnyc2001

I have not found a solution yet. I am using the latest version of the calendar. None of my admin accounts can access layers. They all receive the "You are not authorized!" message.

Tharrington86 avatar Nov 27 '23 15:11 Tharrington86

me neither. would love to find a solution to this!

marcnyc2001 avatar Nov 27 '23 16:11 marcnyc2001

I tried to create a new Admin user and experienced the same issue. Here is a screen shot of what is seen in the console when the !!!You are not authorized message is displayed.

image

Tharrington86 avatar Nov 28 '23 18:11 Tharrington86

Does your admin user have rights to layers?

hc_1322

max951 avatar Feb 07 '24 15:02 max951

I thought mine does. The issue is I get a "You are not authorized!!!" error so I can't even enable or disable them on my Admin page!

marcnyc2001 avatar Feb 07 '24 15:02 marcnyc2001

I'm not sure exactly which page you mean that displays the authorization hint. What is the exact path in the address bar?

max951 avatar Feb 07 '24 19:02 max951

The link is: /calendar/layers.php and the error is: "!!!You are not authorized." Written with 3 exclamation marks at the top of the sentence!

marcnyc2001 avatar Feb 07 '24 19:02 marcnyc2001

If you have access to the database, can you please check if the the admin user has all access permissions.

You can do this in MySQL with the statement SELECT * FROM webcal_access_function WHERE cal_login = 'admin'

or for example in phpMyAdmin, look in table webcal_access_function in the row for user admin. There should be only 'Y's in the permissions column. Like in this Screenshot

image

If there is a 'N' between the 'Y's, your admin user has not all permissions.

max951 avatar Feb 07 '24 20:02 max951

Yep, they are all set to "YYYYYYYYYYYYYYYYYYYYYYYYYYYY" on my Admin Account

marcnyc2001 avatar Feb 08 '24 05:02 marcnyc2001

and the login name is 'admin'? If the login name is different, is the admin flag set for this user?

max951 avatar Feb 08 '24 10:02 max951

No the login name is my username (there is no username named "admin") but in the 'webcal_user' row the column 'cal_is_admin' is set to Y

marcnyc2001 avatar Feb 08 '24 19:02 marcnyc2001

Sorry, but then I don't know what to do. I would try to debug starting from the layers.php file.

I would try something like this line ?><script>console.log("$ALLOW_VIEW_OTHER=<?php echo $ALLOW_VIEW_OTHER; ?>");</script><?php before the line if ( $ALLOW_VIEW_OTHER != 'Y' )

This shows you the value of parameter $ALLOW_VIEW_OTHER in the browser console.

max951 avatar Feb 09 '24 08:02 max951

Thanks for your suggestion Max. I tried that but I didn't see a different output in the browser. In the error_log file there are a bunch of these lines:

[09-Feb-2024 11:59:37 America/New_York] PHP Notice: Use of undefined constant id - assumed 'id' in /home/eastside/public_html/calendar/includes/functions.php on line 4789

marcnyc2001 avatar Feb 09 '24 17:02 marcnyc2001

The obove javascript debug line writes the output in the console, not in the browser itself. You have to use the Browser DevTools ( [F12]-Key )

hc_091

I made this so complicated because the HTML output is not changed and other users are not disturbed by the debugging.

If you can change the HTML output without disturbing other users, then it is of course easier to simply use an echo command instead of the cryptic javascript debug line.

If you are using V1.2.7 the lines if ( $ALLOW_VIEW_OTHER != 'Y' ) echo print_not_auth (7);

should be in lines number 48 and 49.

I assume the line "echo print_not_auth" gives the error message "!!!You are not authorized" if the variable "$ALLOW_VIEW_OTHER" is not 'Y'.

To check this, you can simply insert the line echo '$ALLOW_VIEW_OTHER = ' . $ALLOW_VIEW_OTHER . "<br>\r\n"; before the line with the if statement.

max951 avatar Feb 09 '24 18:02 max951

By adding that line I get:

$ALLOW_VIEW_OTHER = N !!!You are not authorized.

marcnyc2001 avatar Feb 09 '24 18:02 marcnyc2001