Login

Username

Password





Register   Reset password

This is a read-only archive of the forum.

# chrisortman 9/7/2006 9:13 PM
I'm looking at Node.AnonymousViewAllowed and I don't believe I understand how it works. Say I define a role called Farmer, I want farmers to be able to see everything that Anonymous, Authenticated and Editor see. But not if I give View rights for a certain node only to Farmers cuyahoga thinks that anonymous access is allowed because Anonymous is in Farmers list of permissions. I must be missing something, could someone flick a light bulb on for me please.

thanks
# martijnb 9/8/2006 5:42 AM
The names of the rights are a little distracting here because they look too much like the built-in roles.

Lets's see if I can make this clear: The rights that a role has represent an access level. For instance, if a role doesn't have editor rights, it is never possible to assign that role as an editor for a node or section.

Now when setting permissions on nodes and sections, you don't have to think about these access rights. If you want a node or section to be accessible for one role only (for instance, farmers), just give that role view permissions and leave the others unchecked. The fact that the role has anonymous rights, doesn't indicate that anonymous users will be able to see the content.

Hope this helps
# chrisortman 9/21/2006 9:32 AM
Thanks for clearing that up :)
# easfaw 10/21/2006 7:24 AM
How can I accomplish the following using roles:

- For NOT authenticated viewers (I assume Anonymous)
+ I want them to see a log in or register to get
a username message

- Anybody that has loged in
+ I want them to get the actual content

Basically - the Anonymous role does not seem to mean
users that have NOT signed in - is that true?

Also - can you give me a tip in which file to look to put in my own customization of a "Not Authenticated" role.
# martijnb 10/21/2006 7:48 AM
easfaw- For NOT authenticated viewers (I assume Anonymous)
+ I want them to see a log in or register to get
a username message
We have a very rudimentary support for this, check the following line in the web.config:
<add setting="RedirectToLoginWhenAccessDenied" value="true" /> <!-- true/false, customErrors must be enabled -->
Basically - the Anonymous role does not seem to mean
users that have NOT signed in - is that true?

No, the Anonymous role represents unauthenticated users.
Also - can you give me a tip in which file to look to put in my own customization of a "Not Authenticated" role.

Can you explain a little bit more what you mean with this?
# easfaw 10/22/2006 6:40 AM (edited 3/21/2007 4:58 PM)
Martin,

I actually meant that anonymous does not mean strictly not authenticated.

There is a "Test" static html module - that has
Anonymous / View = checked and none of the other roles are allowed to view it.

If you log in using test/tester - it is still visible.

Basically - how can I make it so that that staticHtml module is ONLY visible if you are NOT logged in (not both logged in and not logged in).

The last question I had - was that probably not everyone else wants this - so I was asking in which file I would put my own modifications in. (sorry (a) - a little lazy of me)

Thanks,

E
# martijnb 10/23/2006 5:08 PM
easfawThere is a "Test" static html module - that has
Anonymous / View = checked and none of the other roles are allowed to view it.

If you log in using test/tester - it is still visible.

Allright, now I see your point. Currently allowing the anonymous role indicated that other roles are also always able to view the section. I've thinking about that a while ago and decided at that time that it might be more intiutive to assume that anonymous basically means 'Everyone'. Indeed this makes it impossible to hide a page for authenticated users that is visible for anonymous users.
The last question I had - was that probably not everyone else wants this - so I was asking in which file I would put my own modifications in. (sorry (a) - a little lazy of me)

If you want to override this behaviour, you can change the ViewAllowed() methods in Node and Section.
# easfaw 10/27/2006 11:37 PM
martijnbAllright, now I see your point. Currently allowing the anonymous role indicated that other roles are also always able to view the section. I've thinking about that a while ago and decided at that time that it might be more intiutive to assume that anonymous basically means 'Everyone'. Indeed this makes it impossible to hide a page for authenticated users that is visible for anonymous users.
The last question I had - was that probably not everyone else wants this - so I was asking in which file I would put my own modifications in. (sorry (a) - a little lazy of me)

If you want to override this behaviour, you can change the ViewAllowed() methods in Node and Section.

Man - I love Cuyahoga. Very simple change in the ROOT/domain/section.cs file (similar code in node.cs) to the following for the ViewAllowed(IIdentity):
public virtual bool ViewAllowed(IIdentity user)
{
	User cuyahogaUser = user as User;
//			if (this.AnonymousViewAllowed) {
//				return true;
//			}
	if (cuyahogaUser == null ) {			// new code
		return this.AnonymousViewAllowed;	// new code
	}										// new code
	else if (cuyahogaUser != null) {
		return cuyahogaUser.CanView(this);
	}
	else {
		return false;
	}
}
# markfind 9/14/2008 9:19 AM (edited 9/14/2008 9:22 AM)
I want to be able to show sections only to the anonymous user and, when the user has authenticated, don't show them.

Actual Anonymous special role is a kind of catch-all role, so I need to modify Cuyahoga core to meet the functionality.

On Section.cs and Node.cs of the Core project:
        public virtual bool ViewAllowed(IIdentity user)
        {
            User cuyahogaUser = user as User;
            if (AnonymousViewAllowed && cuyahogaUser == null)
            {
                return AnonymousViewAllowed;
            }
            else if (cuyahogaUser != null && AuthenticatedViewAllowed)
            {
                return cuyahogaUser.CanView(this);
            }
            else
            {
                return false;
            }
        }

When we have Anonymous checked and not the Authenticated role checked I obtain this effect.

Is this a breaking change to the security logic of Cuyahoga or can be merged in the next version of Cuyhaoga?

Marco
# DannyT 4/23/2009 4:19 PM
This thread is a few months old but just found it to be exactly what we were looking for. Can I suggest this be made the default behavior? As this is how we expected it to work.