Wrox Programmer Forums
|
BOOK: ASP.NET Website Programming Problem-Design-Solution
This is the forum to discuss the Wrox book ASP.NET Website Programming: Problem - Design - Solution, Visual Basic .NET Edition by Marco Bellinaso, Kevin Hoffman; ISBN: 9780764543869
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET Website Programming Problem-Design-Solution section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 5th, 2006, 09:52 AM
Friend of Wrox
 
Join Date: Mar 2006
Posts: 310
Thanks: 0
Thanked 0 Times in 0 Posts
Default permission - Publish News Error

First of all, congratulations for the book. I have learned a lot with him.

My Problem:
When I navigate into page "ShowAbstracts.aspx" I have a link in bottom of page: "LinkToSubmitNews -> "SubmitNews.aspx"

In the "ShowAbstracts.aspx" code-behind i have:

Code:
If Not (TypeOf Context.User Is SitePrincipal) _
                    OrElse Not CType(Context.User, SitePrincipal).HasPermission( _
                      CInt(NewsManagerPermissions.AdministerNews)) _
                    OrElse Not CType(Context.User, SitePrincipal).HasPermission( _
                      CInt(NewsManagerPermissions.PublishNews)) _
                    OrElse Not CType(Context.User, SitePrincipal).HasPermission( _
                      CInt(NewsManagerPermissions.SubmitNews)) Then

                LinkToSubmitNews.Visible = False
            End If
BUT, this only work if the current user have all the three permissions!
I've tried tu add a role "PublishNews" and when i navigate into that page, de link is visible-false.

It is enough that it does not have the permission "AdministerNews" for
the link came to visible:False !

What could i do?

Thank you very much!
Max, from Portugal

 
Old March 5th, 2006, 07:16 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 917
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm not sure what the authors intended, but the code is saying that you need all permissions, just as you said. In the sample website, these 3 are all mapped the the same admin role, so it works for users in that role.

If you want to change the logic so you only need one of these permissions, you can just change the if statement. You should be careful with security changes so you don't give someone more permission than you really intended.

Eric
 
Old March 6th, 2006, 05:37 PM
Friend of Wrox
 
Join Date: Mar 2006
Posts: 310
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think that this part of code is wrong because it has this commentary:

Code:
' Check if the current user is allowed to submit or directly
' publish a news AdministerNews, SubmitNews and PublishNews
' are all, but if no one is present hide the link to that page
I've tried to change de statement but the page gave conflict when user was not registed and simply wanted to see the abstracts...

anyone know a identic code to use ?

Tkank you






Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting a permission denied error in IE 7 disto Javascript 1 September 20th, 2007 08:26 AM
publish web site error mazhiguo_1219 ASP.NET 2.0 Professional 3 June 6th, 2007 10:05 AM
publish .NET 2.0 web site Error mazhiguo_1219 ASP.NET 1.0 and 1.1 Basics 0 March 6th, 2007 01:08 AM
Separating news from the articles and add news pic Isaak BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 December 12th, 2006 11:25 AM
Permission Denied Error interrupt Javascript How-To 6 October 15th, 2004 05:26 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.