views:

22

answers:

1

Hi all, I've been having the issue from here:

http://stackoverflow.com/questions/3840502/sharepoint-issue-selective-behavior

and I think I've narrowed the problem down to this XSL code:

<xsl:if test="contains(translate(string(@Author),
                                 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
                                 'abcdefghijklmnopqrstuvwxyz'),
                       translate(substring-after($AuthUser,'\'),
                                 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
                                 'abcdefghijklmnopqrstuvwxyz'))">

In summary, the problem is that some employees that enter information on the list are not able to see it for modification. That piece of code I believe is the part where the application decides to show the information or not. @Author is the person who created the row on the list (I believe its saved in format Firstname SecondName FirstLastName SecondLastName), while $AuthUser should be something like DOMAIN\FirstName LastName.

I'm trying to figure the problem out but I can't tell exactly what that condition checks for. Can anyone explain it to me?

Thanks, EtonB.

A: 

It's doing a case-insensitive "contains this string" comparison (the translate() forces to lower case) between the bit after the slash in $AuthUser, and @Author. So, if, e.g., $Author is "MIKE SMITH" and $AuthUser is "MyDomain\Mike Smith", it'll match.

Because it's using contains() rather than doing an exact match, it'll also match, I think, if @Author is, e.g. "Una Jones" and $AuthUser is "A Jones", though, which seems a bit dangerous.

Matt Gibson
So when $Author is 'Mike John Smith' there'll be no match? Is there any way I can make it match that way? e.g my full name is 'A B C D' but my username is 'A C'
Eton B.
Well, there are always ways of doing this kind of thing, but you'll probably need to consider all the possible combinations that you might need. How does @Author get recorded in the first place? The best way to solve this would be to make sure the source of the two things is the same, and then just compare them... Having said that, rolling your own authentication code for Sharepoint seems a bit odd in general; doesn't it have role-based access security built in along with NT integrated security?
Matt Gibson
Yeah, I also think it's a bit weird, however this is the scope of the task I was assigned so I don't think I can do much else, at least for now. Author is retrieved from the Active Directory names, which for some employees is their full name, while for others just first and lastname (they're the ones for whom it works). I noticed on the top right section of Sharepoint it says Welcome <Name> and if I could somehow retrieve that Name it would be good enough to compare it with Author. Do you know how I can get it as a parameter?
Eton B.
Afraid not -- I think this is heading towards being a Sharepoint question rather than an XSLT question, and I don't know much about Sharepoint... Is the whole page generated from your stylesheet? Can you see the bit that outputs the "Welcome" name?
Matt Gibson