FAQ Permissions radiobox 2.8.1

Please report bugs here!

Moderator: Thorsten

Post Reply
BCooper
Posts: 19
Joined: Mon Jul 01, 2013 10:37 am

FAQ Permissions radiobox 2.8.1

Post by BCooper » Wed Jul 03, 2013 3:16 am

Trying to work this one out...

When creating an FAQ from the backend, I fill out the question info, select the Category 'Test' and as part of this an AJAX request is made (see responses below) and the group and user radio buttons for 'Access for all...' are disabled and unchecked.

As I want to allow all to view I do not click either of the Restrict access buttons because once it is clicked your stuck with it as the radio button for access is disabled (EDIT: Logged: https://github.com/thorsten/phpMyFAQ/issues/719)

I go ahead and save.

Once it saves and goes back in the permissions have been changed to:

Access for all groups
Restricted access to Admin

This happens for both categories 'Test' and 'Test2'.

I can see from the code commenting that you override the FAQ permissions buttons but there appears to be an issue, when the FAQ is submitted without permission data it does not appear to be using the category permissions as the default.

'Test' category has the following permissions:
+ Access for all groups, + Access for all users
AJAX response for category: {"user":[-1,1],"group":[-1]}

'Test2' category has the following permissions:
+ Access for all groups, + Restricted access to User1
AJAX response for category: {"user":[1,2],"group":[-1]}

Tested on Firefox 20 & IE9, however after just testing your demo site it sort of works. If everything is set to "Access for all..." then it works, if there is a restricted option selected then it doesn't check that box. If you start clicking around the different categories then it disables everything.
You do not have the required permissions to view the files attached to this post.
Last edited by BCooper on Wed Jul 03, 2013 4:56 am, edited 3 times in total.

BCooper
Posts: 19
Joined: Mon Jul 01, 2013 10:37 am

Re: FAQ Permissions radiobox 2.8.1

Post by BCooper » Wed Jul 03, 2013 3:55 am

Some more testing...

File: /admin/record.edit.php
Line 699: if ("-1" === perms.user[0]) {
Line 710: if ("-1" === perms.group[0]) {

perms.user[0] is returning as an int

Both of these always return false as it is doing an exact comparison (===) against an int and string.

If I change '"-1"' to just '-1' it works or if I change the operator to '==' it works.

I'm not sure why my AJAX results are returning int where your demo site is returning strings.

From what I can piece together from the database it is an int and should be returning as an int.

Ok some more digging, apparently MYSQL & PHP will return a string (http://stackoverflow.com/questions/5323 ... ing-in-php) where I am using MS SQL it actually returns an int.

Logged: https://github.com/thorsten/phpMyFAQ/issues/718

(PS, Love what your doing with the software and while your looking at my issues I tried to send you some Tim Tam's via your Amazon gift registry but it got all too hard as it wouldn't let me send for some reason (I don't speak German), anyway I donated via PayPal so you can visit the shops to get some Tim Tam's)

Thorsten
Posts: 14792
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: FAQ Permissions radiobox 2.8.1

Post by Thorsten » Wed Jul 03, 2013 6:02 pm

Hi,

thanks for the hint and the donation. I've fixed the issue, just check the github issue.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist

Post Reply