aspose file tools*
The moose likes JForum and the fly likes JFORUM_ROLES entry with user id '0' Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JForum
Bookmark "JFORUM_ROLES entry with user id Watch "JFORUM_ROLES entry with user id New topic
Author

JFORUM_ROLES entry with user id '0'

Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Rafael,

I am trying to add categories by logging in as admin. At some point, my JFORUM_ROLES table got some entries with user_id=0(which does not have a corresponding user in the JFORUM_USERS table). When I add a category, I notice that the process picks up the ROLE_ID entry for a certain GROUP_ID and name='perm_category'. It ends up picking the role ids for these entries with user_id=0 and populates the JFORUM_ROLE_VALUES table. As a result, none of the categories I add show up.
In fact, each entry for name='perm_category' in my JFORUM_ROLES table either has USER_ID=0 or GROUP_ID=0. And, there is no entry is JFORUM_USERS for USER_ID=0 and JFORUM_GROUPS for GROUP_ID=0. How did these entries get into my table? How do I solve this problem and how do I prevent this from happenning in the future? Thanks.

-Mallika
[originally posted on jforum.net by mallikamt]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
This is not a problem, but normal behaviour.

When you set permissions for a group, the field user_id is set to 0, and when you set permissions for an user, the group_id is set to 0.

If you re using 2.1.4, this "cannot seen the category" problem is due some bugs. Go to Admin Panel -> Groups -> Permissions and re-save all.

Rafael
[originally posted on jforum.net by Rafael Steil]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Rafael,

Thanks for the quick response. We are actually using your development version from CVS. I am not getting a message that says 'category cannot be found'. I am just not able to see the new categories added. Should I still save permissions and would this fix it? Also, would this capture the actual user ids and group ids correctly? Or, is there a different table that shows information about the user-category and group-category relationship(which user created which category and so on)? Thanks!

-Mallika
[originally posted on jforum.net by mallikamt]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Hhmm. it was supposed to work correctly.

Let's go: Create a new category, and choose the groups you want to allow access. Then check if it shows up in the main page. If it does not, go to group permission control, check the permissiosn and *save* (it is important to click "Save").

It appears now?

Rafael
[originally posted on jforum.net by Rafael Steil]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Rafael,

It still does not appear. I did the permission save thing for both the groups. After this, I also created a new category hoping atleast the new category would show. This new category does not show either. The tables JFORUM_ROLES and JFORUM_ROLE_VALUES are getting populated though, however they continue to have user_id=0. Thanks!

-Mallika
[originally posted on jforum.net by mallikamt]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
user_id will always be 0 if group_id > 0.

Could you please give some information about your environment? it looks like a bug.

Rafael
[originally posted on jforum.net by Rafael Steil]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Rafael,

We are using MySql 4.1. I printed some statements in the log files. All the categories get picked up when the first main page is rendered. However, this check fails

public static boolean isCategoryAccessible(PermissionControl pc, int categoryId)
{
return pc.canAccess(SecurityConstants.PERM_CATEGORY, Integer.toString(categoryId));
}

and that's why the categories do not actually end up being shown.

-Mallika
[originally posted on jforum.net by mallikamt]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
This is JForum 2.1.4 or 2.1.5? If it's 2.1.4, please get the latest cvs head and try it, please, and let me know if the bug is gone (becuase it should )

Rafael
[originally posted on jforum.net by Rafael Steil]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Rafael,

I got the latest code from CVS for JForum, the problem still persists. Currently, what happens is when a category is added, it is added to the database with the right permissions/role values. However, the roles list , specifically the list returned by role.getValues() in pc.canaccess does not get refreshed...so when tomcat is shut down and restarted, the roles list does get refreshed and pc.canaccess returns true and the category shows..This is a bug, isn't it?

Regards,
Mallika
[originally posted on jforum.net by mallikamt]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Ah, that's a bug for sure!.

Rafael
[originally posted on jforum.net by Rafael Steil]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JFORUM_ROLES entry with user id '0'