• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Error when trying to change group permissions

 
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I open up the group permissions for the 'General' group, I go to the Anonymous Posts item, and select each forum to deny anonymous posting to all forums. When I save, I get a sql error:



Is there a way to get jforum to print the actual sql to the log? Or is this a fix someone is familiar with? Any help would be appreciated.

BTW, just got finished installing JForum and so far I like it very much. Kudos to the authors.
[originally posted on jforum.net by Anonymous]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

This is the same person as the previous post; I've registered and created an account for myself.

I'd like to create forums where users have to log in in order to post. I thought that by creating a forum with 'deny anonymous posts' selected, this would do what I wanted.

What I found is that for that forum, no 'New Topic' button appears for that forum even if I'm logged in as Admin. So no topics can be created in this forum.

Am I doing something wrong here? Any help would be appreciated.

Pat
[originally posted on jforum.net by heehaw]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Much probably the forum is marked as "read only" (there is a permission with this name).

Rafael
[originally posted on jforum.net by Rafael Steil]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am getting the same error in a new JForum installation. JForum 2.1.5 w/ MySQL 3.23.

It doesn't like the deleteAllRoleValues sql statement. I am not a sql guy, but it seems that multi-table deletes may not be supported in MySQL prior to 4.0.

The offending sql statement from WEB-INF/config/database/mysql is:

PermissionControl.deleteAllRoleValues = DELETE jforum_role_values \
FROM jforum_role_values rv, jforum_roles r \
WHERE r.role_id = rv.role_id \
AND r.group_id = ?

However, I note that other statements in this file also use multi-table deletes, so I assume I'm going to have trouble with all of them.

Any suggestions? Am I understanding the problem correctly? Is JForum known to have ever worked with MySQL prior to 4.0?
[originally posted on jforum.net by 2wav]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sadly the best fix I could find for MySQL 3.23 is to replace the existing deleteAllRoleValues statement with two statements and some hand-rolled parsing. Maybe this is just my ignorance of sql, so if anyone knows of a better way I would appreciate suggestions. The two sql statements I use in place of deleteAllRoleValues are shown below:


# #########################
# deleteAllRoleValues
# - doesn't work with mysql 3.23
# alternative uses the next two statements
#
PermissionControl.deleteAllRoleValues = DELETE jforum_role_values \
FROM jforum_role_values rv, jforum_roles r \
WHERE r.role_id = rv.role_id \
AND r.group_id = ?

# 3.23 - get ids to delete
PermissionControl.getRoleIdsByGroup = SELECT DISTINCT rv.role_id \
FROM jforum_role_values rv, jforum_roles r \
WHERE r.role_id = rv.role_id \
AND r.group_id = ?

# 3.23 - delete role values with ids in a csv list
# note - the ? is not a real PreparedStatement param, just a marker used to
# parse and insert the list _before_ passing to prepareStatement(sql)
# (see GenericGroupSecurityDAO.deleteAllRoles)

PermissionControl.deleteRoleValuesByRoleID = DELETE FROM jforum_role_values \
WHERE role_id IN ( ? )



There are several DELETE statements in mysql.sql that I assume will all have a similar problem.

[originally posted on jforum.net by 2wav]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All delete statements work. However, for mysql 4.1+, the file mysql_41.sql should be used. Probably the installer is not handling it correctly. Ah, and version 2.1.5 is not 100% stable yet

Rafael
[originally posted on jforum.net by Rafael Steil]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On two MySQL 3.23 installations (that I am testing with) the delete statements do not work (sql syntax error). I tested them from the mysql shell app also. It seems that the multiple table join in a delete statement isn't recognized prior to 4.0. I would love to be wrong. If there is a way that these statements or something like them can be made to work on mysql 3.23, I will be thrilled.

I pulled 2.1.5 from cvs because I needed the SSO implementation. After I get my customized installation working, I planned to consider merging from HEAD again or whatever milestone might be more stable and compatible with the SSO and style changes I'm making.

BTW, I did a manual install. It seemed to go ok.
[originally posted on jforum.net by 2wav]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I'll download mysql 3.23 and see what's happening.

Rafael
[originally posted on jforum.net by Rafael Steil]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wouldn't ask you to do that on my account. I believe that I have identified the problem and created a not-pretty workaround for my project.

I guess it depends whether you want to support 3.23. It is a requirement for my current project, but other than that I am not a good judge of how critical it is. Also 3.23 is the current available yum binary for FC3...which was very convenient for me when I set up my dev environment.
[originally posted on jforum.net by 2wav]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

2wav wrote: believe that I have identified the problem and created a not-pretty workaround for my project.



... which is.. ?

Supporting mysql 3.23 is fine to me! Just let me know what you have found.

Rafael
[originally posted on jforum.net by Rafael Steil]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
as described in the "my ugly solution" post above. The statement


PermissionControl.deleteAllRoleValues = DELETE jforum_role_values \
FROM jforum_role_values rv, jforum_roles r \
WHERE r.role_id = rv.role_id \
AND r.group_id = ?



just can't be done in one statement in MySQL 3.23. Or at least that's how it seems from this MySQL doc:
http://dev.mysql.com/doc/mysql/en/delete.html


From MySQL 4.0, you can specify multiple tables in the DELETE statement to delete rows from one or more tables depending on a particular condition in multiple tables. However, you cannot use ORDER BY or LIMIT in a multiple-table DELETE.

The first multiple-table DELETE syntax is supported starting from MySQL 4.0.0. The second is supported starting from MySQL 4.0.2. The table_references part lists the tables involved in the join. Its syntax is described in Section 13.1.7.1, ���JOIN Syntax��?.

For the first syntax, only matching rows from the tables listed before the FROM clause are deleted. For the second syntax, only matching rows from the tables listed in the FROM clause (before the USING clause) are deleted. The effect is that you can delete rows from many tables at the same time and also have additional tables that are used for searching:

DELETE t1, t2 FROM t1, t2, t3 WHERE t1.id=t2.id AND t2.id=t3.id;

Or:

DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.id=t2.id AND t2.id=t3.id;



so my solution is to execute one query to get the role ids of interest, and another to delete them.

My hack is attached for reference. Be warned I just play at java on weekends...
[originally posted on jforum.net by 2wav]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. I'm having a number of problems with my installation of JForum 2.1.4.

- Anonymous posts always allowed. I have used the Admin interface to disallow Anonymous posts for all user groups, but the change seems not to take effect. In the jforum_roles table, I have changed the flag for anonymous posts ( don't remember the exact key name ) to 0, and then to 1, followed by restarts, but I cannot disable anonymous posts.

- Login session is not stable. I login as Admin and my session is dropped when I get to the message list in any of the forums. This is particularly bad because an anonymous user has posted an offensive remark that I now cannot delete (at least until I can get access to the db).


I noticed that this forum uses version 2.1, and I have none of the session issues that I'm having with my install of 2.1.4. Perhaps this session instability is something that has happened between those versions. Is it possible to get an old version of JForum?
[originally posted on jforum.net by heehaw]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This forum has version 2.1.4, but it's showing version 2.1 because I usually update the files by hand (copy here and there).

Which OS are you using, as well the database vendor and verion.. ?

Also, please note that once you have set permissions for an user (and not the group), changing the group permissions will not affect the user permissions if you do not check "Set Users' Role to follow the Group".

Rafael
[originally posted on jforum.net by Rafael Steil]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, I have made a package based on Andy's work and put it available to download. Please check

http://www.jforum.net/confluence/display/configuration/MySQL+3.23

Rafael
[originally posted on jforum.net by Rafael Steil]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using jforum 2.1.4 with MySQL 4.0.23, I am getting this when I try to change permissions for the General group:



Seems to be a simple missing '(' issue.

-Steve
[originally posted on jforum.net by yetanothersteve]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

yetanothersteve wrote:



Same problem here
[originally posted on jforum.net by pala]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An error has ocurred. For detailed stack trace, please see the page's source code.

You have an error in your SQL syntax near 'SELECT role_id FROM jforum_roles WHERE group_id = 1)' at line 1


!!!
I've re-installed jforum and applied your patch exactly as you have described twice over. but still... nothing.

The only bit of the forum that doesn't work is when I try to edit and save Group permissions.

I'm using MySql 3.23.
[originally posted on jforum.net by Anonymous]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, crapy mysql 3.23.

Rafael
[originally posted on jforum.net by Rafael Steil]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rafael,
I did as you provided in your patch, and it doesn't help.
http://www.jforum.net/confluence/display/configuration/MySQL+3.23

I still cannot restrict Anonymous Posts... Ohh, JForum.. :roll:
[originally posted on jforum.net by Evgeny]
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!