Forum OpenACS Development: Should object_id 0 be a user or a person?

If we want to allow anonymous postings in various packages, it seems convenient to make object_id 0 a user or person. Right now at least the forums package requires that the object_id of the poster exist in the users table.

The other option would be to change the foreign key in forums_messages to refer to the persons or parties table.

Perhaps a general guideline of referring to persons instead or users?

Collapse
Posted by Ola Hansson on
Dave,

having a choice to post anonymously would be cool in Forums and General Comments, for instance - if configured that way, of course.

Would it be useful to also allow a "group" or organization (i.e., a party) to post a collective statement ... semi-anonymous postings, sort of?

Collapse
Posted by Barry Books on
I think having an anonymous user subsite parameter would do it. If it's set then that user is the anonymous user for that subsite, if not then there is not one. If the subsite could take care of "logging" you in as that user then the other packages would not need to change.
Collapse
Posted by Dave Bauer on
Barry,

The system already returns 0 for user_id if the user is not logged in. This should work under any subsite. I don't see a need for a seperate not logged in user for every subsite. The question here is that object_id 0 is a person, but not a user.

Collapse
Posted by Don Baccus on
Yes, Jeff Davis and I talked quite some time ago about making object_id 0 be a user rather than person.  I didn't do it during the big permissions update (before that there was no person 0 and user_id == 0 was special cased in the permissions system) because I was uncertain of the ramifications.

It would allow for anonymous posts but we probably want to turn off access to things like the user portrait page (you don't really want anonymous users to upload "their" portrait, etc) before making the change.

Collapse
Posted by Dave Bauer on
Don,

Would changing the foreign key from users to persons accomplish the same goal, allowing anonymous postings (if desired) which not giving object_id 0 a user portrait etc.

This also would allow users to be removed, which keeping the person row existing. I am not sure what other kind of problems this might bring up. I am sure someone will let me know :)

Collapse
Posted by Barry Books on
I don't think object_id 0 should be a user because ueer_id of 0 means not logged in. I suppose you could make every package that needs to support anonymous users support a user_id of 0, but it seems much simpler just to make an anonymous user and login as that user. Then if you don't want one don't make one.

All that needs to be done is add a link on the login page that allows logging in as the anonymous user. You could even make the whole subsite anonymous and the login page just logs everyone in as the anonymous user. Or just make your package login users as anonymouns.

If you need to disable functions on the anonymous user just get the anonymous user_id instead of assuming it's 0.

Making user_id 0 a real user seems like a major change to me. I would prefer to get a request error if I happen to use user_id 0 instead of everything just going along as normal. I would not want a coding error to result in everyone being an anonymous user.

Collapse
Posted by Don Baccus on
Well ... person_id 0 is already a real person and the only side-effect has been to speed up permissions checking in Postgres by up to a couple of orders of magnitude in some cases.

Barry, don't worry, this change won't be made without considering the consequences.  And if we do make the change the default permissions which only allow registered users to write content would remain in force (person_id 0 is a member of "The Public" but not "Registered Users" and that would *not* change)  So unless someone makes an explicit choice to allow The Public (or person_id 0 explicitly) to write new content no coding error other than failing to check permissions could allow someone not logged in to create content - and if permissions aren't checked that's true regardless of how we represent a user that's not logged in.

And since the default membership group for the main subsite is "Registered Users" and since subsites can only draw new members from their parent's membership group making person 0 a user would require that the admin *explicitly* add the "Unregistered Visitor" (as person 0 is called today) to the main subsite.

So I think most of your objections would, in practice, be met if this change were made.

Collapse
Posted by Lars Pind on
Actually, I don't think you'd need to make any changes, if 0 was made to be the anonymous user. pvt/home won't show your account if your user_id is zero, for example. And the current login-status box should work just the same. Of course, we have to check, but the logic that not-logged-in is zero, should work perfectly.

/Lars

Collapse
Posted by Lars Pind on
So just for kicks, I did this:

- granted 'forum_create' to "The Public" (turns out the privilege 'forum_post' isn't used anywhere at all, we should remove it)

- insert into users (user_id) values (0);

Lo and behold, without any further changes, I can now make anonymous postings to forums, and they show up as having been made by "Unregistered Visitor".

The only glitch I can see is that when you click through the name to see the forums posting by Unregistered, and then click  through the name again to see the user's community-member page, that page just says:

"No user found
There is no community member with the user_id of 0"

Because the unregistered user isn't in cc_users, because that view only shows people who are part of 'registered users'. Which is probably the way we want to keep it, so we just need the community-member page to special-case the unregistered visitor user and say something meaningful then. Trivial fix.

Now, the only tricky problem I see is one of UI: I think we still want to *encourage* people to sign in, even though they *can* post anonymously.

The best way I can think of to do that is to still redirect to the login page, but then have an option there that says "continue as anonymous guest user" or something to that effect. We should probably make it a page parameter to determine whether we should offer that option or not, as clearly in most cases we do not. Yet.

So [ad_redirect_for_registration -allow_anonymous]?

The drawback is that we're going to flash this login page every single time you want to do something where we encourage you to log in, such as posting to the forums.

How does that sound?

/Lars

Collapse
Posted by Benjamin Bytheway on
One additional need should be taken into consideration.  I have a situation where I need to require a user to be registered to post, but that registered user should have the ability to post anonymously.

Just another wrinkle to throw into the mix.

Collapse
Posted by Lars Pind on
Ben,

That's a fairly simple thing to do once we have the other part. That would just involve a checkbox that says "post anonymously", and, if checked, we create the post with user_id 0.

/Lars

Collapse
Posted by Benjamin Bytheway on
I assumed it would be something easy.  I just wanted to bring up this scenario as well.
Collapse
Posted by Caroline Meeks on
This seems like a good place to collect use cases relating to anonymousity so I want to post another wrinkle from the dotLRN Course Evaluation requirements.

When a student fills out a course evaluation the UI should never associate a specific response with a specific student, even to an administrator.  However, the system must keep track of the fact that a specific student has replied, so that they can only reply once, students who haven't replied can be spammed and reminded to reply, etc.

In addition, the people I interviewed would like to be able to find out who made a reply in extreme circumstances (for instance an abusive or threatening response). Having a programmer able to query the real user_id is sqlplus/pgsql would meet this requirement.

Collapse
Posted by Barry Books on
One thing to remember is session timeout. I've found alot of problems where pages call ad_conn user_id. If the id returned is 0 then maybe they want to post as anonymous, but then again maybe they should relogin. I'm also not quite sure what ad_redirect_maybe_for_registration should do.
Collapse
Posted by Tom Jackson on

I always liked using negative integers for objects that should only be created for special purposes. They stay out of the way of regular objects. Having an overloaded object_id "0" seems like a quick and easy way to run into problems. What is the reason that only one such account needs to exist? I really would not like to mix up anonymous for x application with anonymous for y application, because anonymous can have many different meanings.

Caroline makes a good point. However anonymous a user might need to be to certain audiences, they should never be untraceably anonymous, we all know we need to track users, even if they are transient, or need to make certain statements without everyone knowing who they are.

Additionally, an anonymous user may wish to have consistent identity on the website, even if it isn't associated with a valid email or real name. At some point in time they may wish to convert their account to a non-anonymous account.

If anonymous accounts exist, they should be easy to create, maybe requiring only a (screen)name and password. It might also be nice to add the ability of anonymous users to post without using cookies, by providing the name/password at the time of the post, or as a second step to posting without being logged in. However, this might make it a little too easy for a program to create many accounts just by posting to a single page.

Collapse
Posted by Lars Pind on
Ben,

FYI, I did the "Post anonymous" checkbox just now.

Unfortunately, I won't get a chance to commit this myself until I get back from my honeymoon on 30 June, but you can try bugging Peter Marklund and have him bug Yon to send you a patch if you need it sooner.

Ah, and I only did this for Postgres. Will do Oracle before I commit, obviously.

/Lars

Collapse
Posted by Benjamin Bytheway on
That's great, Lars.  My development timeframe is still pretty variable (it's a personal site), so I haven't yet determined which version of openACS to base it on.  I'm having thoughts about waiting for 5.0, but helping put some of the my needed enhancements into that toolkit in the mean time. It's a perpetual problem: the next version of openACS always has too many good things that tempt me to wait. Sooner or later I'm just going to have to stop the merry-go-round and start developing.

Anyway, I look forward to all these new features that are coming down the pipeline and hope to add a few of my own.