Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

So my sceario is this. I have a subsite and in this subsite i have a custom webpart that displays that from a blog under this subsite via web services. The user doesn't has no permission to the blog and the posts list but when i open up the subsite i can see data on the custom webpart.

But when i click the link to view more data then i get access denied error.

But the problem is i don't want the user to see any data at all since he doesn't have access.

I have tried using all the IfHasRights - (ViewListItems - 1 ) Tried this

<xsl:if test="ddwrt:IfHasRights(1)">
<xsl:call-template name="dvt_1.rowview" />
</xsl:if>

But doesn't work Thanks

Any ideas? Thannks

share|improve this question
    
Hmm... You wrote that you're using a custom webpart. But then, where do you put the XSLT? Are you actually using DataViewWebPart? –  Andrey Markeev Jun 1 '12 at 7:07
    
Yeah Andrey i'm using Dataview webpart via sharepoint designer –  naijacoder Jun 1 '12 at 23:48
add comment

1 Answer 1

IfHasRights checks the permissions based on the following permission set:

private SPBasePermissions CurrentPermissions()
{
    if (base.wp is DataFormWebPart)
    {
        DataFormWebPart wp = base.wp as DataFormWebPart;
        if (wp.ListItem != null)
        {
            return wp.ListItem.EffectiveBasePermissions;
        }
        if (wp.SPList != null)
        {
            return wp.SPList.EffectiveBasePermissions;
        }
        if (base.wp.Web != null)
        {
            return base.wp.Web.EffectiveBasePermissions;
        }
    }
    return SPBasePermissions.EmptyMask;
}

Which means that if the Webpart isn't inheriting from DataFormWebPart it'll return false. If it is then it'll be based on the general level of the DataFormWebPart

share|improve this answer
    
ThanksSorry Per i'm using DWP. –  naijacoder Jun 1 '12 at 23:48
    
+1 for your exploration, Per! –  Andrey Markeev Jun 2 '12 at 8:58
1  
@naijacoder: 1. DataViewWebPart inherits from DataFormWebPart. so Per's answer holds true. 2. Since obviously you're using SoapDataSource in conjunction with DVWP, IfHasRights will contain current user's permissions for the current web. Thus, IfHasRights will not do here for your purpose. –  Andrey Markeev Jun 2 '12 at 9:00
    
Thanks guys and that why my intention was to use IfHasRights but which number permisionMask will work for me in my scenario. See my original post. Cheers –  naijacoder Jun 4 '12 at 0:10
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.