https://www.icyphoenix.com/viewtopic.php?f=35&t=8128
-----------------------------------
ganesh
Fri 30 Sep, 2011 09:52

Can't Change Permission
-----------------------------------
Hi all,

One moderator of mine left, so I removed him from moderators group and so on...
Now, he IS a normal registered user but still appears as a Moderator under a specific forum.
That's because when I try to change his permissions and I choose "is not moderator" the ACP keeps saying:

[quote]Couldn't obtain user/group permissions

DEBUG MODE

SQL Error : 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND g.group_single_user = 1' at line 1

SELECT aa.*, g.group_single_user FROM phpbb_auth_access aa, phpbb_user_group ug, phpbb_groups g WHERE ug.user_id = 18 AND g.group_id = ug.group_id AND aa.group_id = ug.group_id AND aa.forum_id = AND g.group_single_user = 1

Line : 280
File : admin_ug_auth.php[/quote]

Any ideas? Thanks in advance.


-----------------------------------
mort
Fri 30 Sep, 2011 11:43

Re: Can't Change Permission
-----------------------------------
Did you clear the cache after you made the changes?

You also have Db Maintenance in the ACP to clean tables - did you try that?


-----------------------------------
ganesh
Fri 30 Sep, 2011 11:44

Re: Can't Change Permission
-----------------------------------
Yes, I did clean the cache, and no, I didn't clear any table.


-----------------------------------
mort
Fri 30 Sep, 2011 12:32

Re: Can't Change Permission
-----------------------------------
[quote user="ganesh" post="53930"]I didn't clear any table.[/quote]

Db Maintenance doesn't clear tables, it's a repair tool to fix many errors that develop in the DB from time to time.

[b][i]A word of advice[/i][/b] - Only use the parts of it you fully understand or you can get into problems with it. And better still - Do a full backup of your DB before you start.

;)


-----------------------------------
ganesh
Fri 30 Sep, 2011 12:37

Re: Can't Change Permission
-----------------------------------
Oh... You meant that. Ok, I did it, nothing changes.


-----------------------------------
Informpro
Fri 30 Sep, 2011 17:33

Re: Can't Change Permission
-----------------------------------
Hi.

[code]SELECT aa.*, g.group_single_user FROM phpbb_auth_access aa, phpbb_user_group ug, phpbb_groups g WHERE ug.user_id = 18 AND g.group_id = ug.group_id AND aa.group_id = ug.group_id AND aa.forum_id = AND g.group_single_user = 1[/code]The problem is "AND aa.forum_id = AND". The forum ID is missing.

It looks like you're not running the last version, so could you please
1) try with the latest github version
2) give me the lines around 280 (5 lines I.E., saying which is the 280°)


-----------------------------------
ganesh
Fri 30 Sep, 2011 19:10

Re: Can't Change Permission
-----------------------------------
[b]Informpro[/b], thank you very much.

The version is 1.3.0.53b.
I cannot try github versions, upgrades are a pain for my forum.

Anyway, here's the entire file if you want. Keep in mind that the problem is not related to all users, but to this specific one.


-----------------------------------
Informpro
Fri 30 Sep, 2011 19:28

Re: Can't Change Permission
-----------------------------------
If this works with other members, it's strange. Would you please try moidifying permissions of a different user (same forum), and different forum (same user). Also try in Adv. mode. I'll try to installed IP 1.3b ASAICan to find out what's happening.


-----------------------------------
ganesh
Fri 30 Sep, 2011 19:33

Re: Can't Change Permission
-----------------------------------
Different user (same forum), everything's fine.
Different forum (same user), same error.

And for this user I only can see Adv. Mode, no way to see it simple. It's very strange, indeed.


-----------------------------------
mort
Sat 01 Oct, 2011 00:25

Re: Can't Change Permission
-----------------------------------
If you google those sql strings you'll see that Nuke and phpBB has similar problems. And from what I can make out - it has something to do with downgrading the user at the very same time he's posting something.

I didn't read into it too much - I'll leave that to you and informpro. :)


-----------------------------------
Informpro
Sat 01 Oct, 2011 17:56

Re: Can't Change Permission
-----------------------------------
Well, I talked about it with Mighty Gorgon and he thinks your table is corrupted. AFAI Can See[code]					while(list($forum_id, $value) = @each($_POST['private_' . $auth_field]))
					{
						$change_acl_list[$forum_id][$auth_field] = $value;
					}[/code]I think this problem may cause another problem(s) later, so if you can lend me an admin account (to change permissions) + ftp account (to edit the file) I'd like to try to solve the problem - no problem if you can't.


-----------------------------------
ganesh
Sat 01 Oct, 2011 18:28

Re: Can't Change Permission
-----------------------------------
[b]Informpro[/b], I'd be glad.
No problem for the admin account. But I don't have any ftp account. I make everything through sftp from my Mac in Milan. But I can access files only from there.
If you want, I can give you the files anyway.


-----------------------------------
Informpro
Sat 01 Oct, 2011 18:42

Re: Can't Change Permission
-----------------------------------
Sftp is okay, give me these infos through MP and I'll look ASAICan.


-----------------------------------
Mighty Gorgon
Sun 02 Oct, 2011 01:21

Re: Can't Change Permission
-----------------------------------
Hi my friend, I hope you are fine.

You can try this:

OPEN [b]adm/admin_ug_auth.php[/b]

FIND
[codeblock]					while(list($forum_id, $value) = @each($_POST['private_' . $auth_field]))
					{
						$change_acl_list[$forum_id][$auth_field] = $value;
					}

					if (!isset($used_forums[$forum_id]))
					{
						$sql = ($mode == 'user') ? ("SELECT aa.*, g.group_single_user FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE. " g WHERE ug.user_id = $user_id AND g.group_id = ug.group_id AND aa.group_id = ug.group_id AND aa.forum_id = $forum_id AND g.group_single_user = 1") : ("SELECT * FROM " . AUTH_ACCESS_TABLE . " WHERE group_id = $group_id AND forum_id = $forum_id");
						if (!($result = $db->sql_query($sql)))
						{
							message_die(GENERAL_ERROR, "Couldn't obtain user/group permissions", "", __LINE__, __FILE__, $sql);
						}
						if ($row = $db->sql_fetchrow($result))
						{
							for ($k = 0; $k < count($forum_auth_fields); $k++)
							{
								$change_acl_list[$forum_id][$forum_auth_fields[$k]] = $row[$forum_auth_fields[$k]];
							}
						}
						$used_forums[$forum_id] = 1;
					}[/codeblock]

REPLACE WITH
[codeblock]					while(list($forum_id, $value) = @each($_POST['private_' . $auth_field]))
					{
						// Mighty Gorgon: I have moved this part of code in this cycle to be able to use $forum_id var, otherwhise it was not assigned...
						// FORUMS AUTH MOVED CODE - BEGIN
						if (!isset($used_forums[$forum_id]))
						{
							$sql = ($mode == 'user') ? ("SELECT aa.*, g.group_single_user FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE. " g WHERE ug.user_id = $user_id AND g.group_id = ug.group_id AND aa.group_id = ug.group_id AND aa.forum_id = $forum_id AND g.group_single_user = 1") : ("SELECT * FROM " . AUTH_ACCESS_TABLE . " WHERE group_id = $group_id AND forum_id = $forum_id");
							$result = $db->sql_query($sql);

							if ($row = $db->sql_fetchrow($result))
							{
								for ($k = 0; $k < sizeof($forum_auth_fields); $k++)
								{
									$change_acl_list[$forum_id][$forum_auth_fields[$k]] = $row[$forum_auth_fields[$k]];
								}
							}
							$used_forums[$forum_id] = 1;
						}
						/*
						*/
						// FORUMS AUTH MOVED CODE - END
						$change_acl_list[$forum_id][$auth_field] = $value;
					}[/codeblock]


Let me know if it works for you.


-----------------------------------
ganesh
Sun 02 Oct, 2011 11:59

Re: Can't Change Permission
-----------------------------------
Hi Luca, glad to hear from you.
Your patch worked flawlessly, thank you very much.
Everything now seems to work fine.

What I have to do now? I keep the patched file or do I restore the old one? :shock: 

Thank you so much, as usual.


-----------------------------------
Joshua203
Sun 02 Oct, 2011 14:00

Re: Can't Change Permission
-----------------------------------
[quote=MG in private discussion]tell him to keep the patched file... it has been patched in the last Icy Phoenix version also some time ago :)[/quote]

 :wink:


-----------------------------------
ganesh
Sun 02 Oct, 2011 14:03

Re: Can't Change Permission
-----------------------------------
I see, thank you very much!

Only for information, which is the last stable version of IP? :?


-----------------------------------
Joshua203
Sun 02 Oct, 2011 14:09

Re: Can't Change Permission
-----------------------------------
Icy Phoenix 1.3.0.53b = last stable release ganesh


-----------------------------------
ganesh
Sun 02 Oct, 2011 14:11

Re: Can't Change Permission
-----------------------------------
Ok, my one so.
TY.


-----------------------------------
Joshua203
Sun 02 Oct, 2011 14:41

Re: Can't Change Permission
-----------------------------------
You are very welcome ...I've marked this solved for you ...have a GREAT day  :wink:



EDIT: my compliments on your site BTW ...very Nice  :)


-----------------------------------
ganesh
Sun 02 Oct, 2011 16:26

Re: [SOLVED]   Can't Change Permission
-----------------------------------
[b]Joshua203[/b], glad you like it.
I saw your answer using my iPad and the new mobile optimization, is so cool... :shock:


-----------------------------------
Mighty Gorgon
Thu 06 Oct, 2011 00:31

Re: [SOLVED]   Can't Change Permission
-----------------------------------
I'm glad you like it my friend. :mri:

You can test it with the latest beta. :mri:


