Florian @ SharePoint UserGroup



Ein paar Tipps rund um CustomActions am Beispiel GetEffectivePermissions 

Tags:

Nachdem ich mich gerade "ein wenig" mit ein paar "Themen" rund um CustomActions beschäftigt habe (freundlich ausgedrückt – immerhin ist es 04:00 in der Früh und ich hab mich durch aus ein wenig geärgert) – möchte ich der weiten Welt meine Erleuchtungen nicht vorenthalten :)

Grundsätzlich sind ja CustomActions eine einfache Möglichkeit in SharePoint eigene Menüeinträge in den Websiteeinstellungen, Listeneinstellungen, beim Menu eines Elements, … hinzuzfügen –> um mit einer Verlinkung dann auf einer eigenen Seite eigenen Code auszuführen. Wir verwenden das eigentlich überall… angefangen von eigenen Konfigurationseinstellungen in der Zentraladministration bis hin zu eigens hinterlegten Upload-Seiten bei Dokumentenbibliotheken.

Wir haben jüngst eine relativ einfache Solution geschrieben um bei einer Bibliothek / Ordner die effektiven Berechtigungen - wirklich runtergebrochen auf den User – anzuzeigen, d.h. jeder Benutzer der in einer Bibliothek / Ordner was hochladet, soll sich ansehen können –> wer darf eigentlich das was ich hochlade sehen? Die Anforderung ist grundsätzlich nicht so banal, weil man einerseits SharePoint-Gruppen und verschachtelte Active Directory Gruppen auflösen muss um alle effektiven Berechtigungen pro Benutzer wirklich darstellen zu können – aber das ist eine andere Geschichte, hier gehts um die CustomAction…

Die Solution ist relativ einfach aufgebaut – es gibt ein Feature SharxXPermission\MenuEntries und eine layouts-Seite ElementPermissions.aspx

In der MenuEntries.xml ist eine CustomAction (grundsätzliche Einstellungsmöglichkeiten findet man hier - http://msdn.microsoft.com/en-us/library/ms460194.aspx und in welche Menü's man sich überall hineinhängen kann hier http://msdn.microsoft.com/en-us/library/bb802730.aspx)  hinterlegt

Bis dato noch relativ einfach – vor allem kann man auch über definierte Tokens verschiedene Parameter bei der Url mitgeben (http://hristopavlov.wordpress.com/2008/12/08/urlaction-tokens-of-the-customaction-feature/). Aber man hat ja hohe Ansprüche an sich selbst und will alles perfekt machen. Und wie sollte das aussehen? Natürlich am besten so wie direkt im SharePoint und zwar sollte man über den Breadcrumb erkennen, wo man sich gerade die Berechtigungen ansieht (egal in welcher Subwebsite und in welchem Unterordner man sich befindet). Also so:

Ha – da wirds schon ein wenig kniffelig :)

Damit man den Standard BreadCrumb vom SharePoint verwenden kann muss man im Layouts Verzeichnis ein eigenes xml File anlegen nach der Namenskonvention layouts.sitemap.[eigener Name].xml  und dort definieren wie man sich in den SharePoint über den SPContentMapProvider hineinhängen will.

 

Wer es ganz perfekt machen will, der hängt zu seinem Feature noch einen EventReceiver der beim FeatureActived folgenden Code ausführt

dann wird auch alles vollautomatisch deployed (ansonsten muss man noch händisch ein STSADM -o copyappbincontent ausführen – damit das auch in _app_bin/layouts.sitemap deployed wird)

 

So aber damit das ganze nicht zu einfach ist, müssen wir jetzt auch noch die richtigen Parameter mit übergeben, damit der SharePoint Breadcrumb uns auch wirklich die komplette Ordnerstruktur aufbaut. Was dazu notwendig ist – findet man einfach heraus in dem man in einem Ordner auf Hochladen klickt oder sich bei einem Ordner die Berechtigungen anzeigt –> dann erkennt man nämlich dass der Breadcrumb einerseits die List (ID) und andererseits den RootFolder braucht. ListID haben wir über den Token, aber wie bekommen wir den RootFolder?? Dazu brauchen wir ein wenig Javascript und das möchte ich aus Zeitgründen nicht genauer erläutern, weil sonst wird es fad (aber falls auch immer es wer brauchen kann - Javascript mit RegularExpressions um bei der aktuellen window.location den RootFolder Parameter auszulesen –> hier die komplette URL-Action:

<UrlAction Url="javascript:function getValue() { var results = new RegExp( '[\\?&amp;]RootFolder=([^&amp;#]*)').exec( window.location ); if(results == null) return ''; else return results[1];  } function redirect(){window.location='{SiteUrl}/_layouts/SharxXPermission/ElementPermissions.aspx?List={ListId}&amp;RootFolder='+getValue();}redirect();"/>

So das hätten wir. Leider gibts noch eine kleine Unzulänglichkeit, die mir eigentlich den Schlaf geraubt hat und zwar wollte ich meinen Menüeintrag unter Aktionen –> Berechtigungen anzeigen für alle Teilnehmer zur Verfügung stellen:

SharePoint liefert uns hier auch die Möglichkeit bei der CustomAction das Attribute Rights (http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spbasepermissions.aspx) zu setzen – was ich auch brav gemacht habe - Rights="AddListItems" leider musste ich nach langem Testen und viel Suchen im Internet erfahren, dass für die Location="Microsoft.SharePoint.StandardMenu" GroupId="Actions" nur die Rechte vom ParentWeb gelten… Tja ich konnte es auch nicht glauben, weil sich ja die Listen-Toolbar aufgrund der Rechte auch verändert – aber einerseits konnte ich das Phänomen auch beobachten und andererseits schreibt das auch ein MSFT von Microsoft - It also seems that the "Rights" of "Microsoft.SharePoint.StandardMenu" belongs to the parent site - http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/12af8d7e-7498-49dd-9e62-f94e2dbc161a

die Lösungsmöglichkeiten von dort sind leider auch nicht wirklich zielführend, also  -> :(… aber ich hoffe zumindest, das derjenige, der über das gleiche Phänomen stolpert nicht so lange testet und deployed und wertvolle Schlafenszeit verschenkt, wie ich…

 

Comments


plus size dress commented on Tuesday, 9-Aug-2011
blog [url=http://www.hsehry.com]blog[/url] blog blog http://www.hsehry.com


plus size dress commented on Tuesday, 9-Aug-2011
plus size occasion dresses plus size occasion dresses plus size dresses for a wedding plus size dresses for a wedding celebrity dress celebrity dress formal dress formal dress modest bride dresses modest bride dresses black & white dresses black & white dresses wedding dresses wedding dresses asian dresses asian dresses cocktail white dresses cocktail white dresses inexpensive evening gowns inexpensive evening gowns


plus dresses commented on Tuesday, 9-Aug-2011
velvet wedding dress velvet wedding dress cheap dresses cheap dresses quinceanera dress quinceanera dress winter wedding gown winter wedding gown wedding gown stores wedding gown stores engagement dress engagement dress chiffon halter dress chiffon halter dress


dresses commented on Tuesday, 16-Aug-2011
The only exception was in February 2100 to maggie sottero the need to have for a leap day, and this operation doesn't interrupt the operation of silver dresses, but not crucial under the guise of the wearer's hands. Due to the vintage wedding dresses foreign calendar (Gregorian calendar) often attempt to guarantee that the length of each and every constant, so the end of 2100, 2 there is going to be no leap day really should for that reason be adjusted to their requirements dress satin.


dresses commented on Tuesday, 16-Aug-2011
The site allows people to send old short wedding dresses - as long as they don't have any rips or stains, and all the zippers and closures still work - for a credit toward a brand new little black dress.Every season the House's DA, Christine Innamorato,flower girl dresses invents an enchanting and creative collection for Bonpoint from newborn to teenagers and YAM - for those young women who are still Bonpoint Girls at heart. Every season the House's DA, Christine Innamorato, invents an enchanting and creative collection for Bonpoint from newborn to teenagers and YAM - for those young women color wholesale wedding dresses who are still Bonpoint Girls at heart.


wedding dress multitudinous commented on Monday, 5-Dec-2011
This is an stimulating time of year for 2010 brides – all of the top designers have just showing their latest collections of wedding gowns in New York, and it won’t be long before the styles hit the stores. This year the gowns were dramatic and eclectic, with a dissimilar flavor than this year’s wedding dresses wedding dresses . Read on for the scoop on the hottest looks for 201
cheap wedding dresseshttp://www.hoboview.com/site/comment/reply/1
0 brides. The wedding gowns wedding gowns being sold this season have a strong leaning towards matte fabrics like chiffon and slender skirts. Not unfeigned for the most recent collection of gowns that was just shown. Brides who want a straighter skirt will surely have a great deal of choices, but most of the most recent gowns feature fuller and more dramatic skirts. One thing is for sure: the ballgown is back. Designers were unquestionably showing dresses with classic ballgown lines, but a good deal of of the fuller skirts had a lot more detail than a traditionalisti ballgown. The drama on the bottom half of the gowns gowns was devised from masses of ruffles, big draped layers, special occasion dresses and even unbelievable pinwheels and three-dimensional flower appliques. Another ordinary look is a gown that is somewhat slender through the hips and then flares into an exaggerated trumpet skirt. The styles are unquestionably eye-catching and exuberant. Speaking of ruffles, they are everyplace for next year’ wedding dresses with long sleeves discount bridesmaid dresses discount bridesmaid dressess gowns. Cascades of ruffles fall down a skirt into an unbelievable full skirt. Strapless gowns feature ruffles on the neckline. Designers were even showing ruffles on little bolero jackets and veils . One thing that these gowns are not is boring or shy.
Fabrics for 2010 bridal gowns bridal gowns are trending back towards the perennial favorites, brown cocktail dress satin and taffeta. This luxe fabrics are just right for the fuller skirts that are back in vogue. You are also seeing satin gowns embellished with accents such as beaded crystal straps, which pair perfectly with crystal bridal jewelry. This is a departure from the current season, which concentered wholly on fabric accents. Brides who love sparkle will be happy to see the return of crystal jewelry detailing on the bridal gowns ! Some of the 2009 gown trends have been carried into next year’s styles. Asymmetry is still all the rage. The one shoulder gown one shoulder gown sticks around for another season, but that is only the beginning. Designers went wild with asymmetrical draping and ruching on bodices and skirts. A love of interesting architecture in the way the fabric is hung and applied is still very popular. It is rare to see a gown that has plain fabric hung without a great deal of sort of folding, pleating, or gathering. One remarkable divergence is that the bridal designers have translated this conception from the soft chiffons of 2009 into the more significant satins of 2010. One other important idea for 2010 bridal gowns is the conception of intentional imperfection. Vera Wang, informal plus size wedding dresses informal plus size wedding dresses in particular, focalized on creating gowns that were eclectic and not too “perfect”. This was achieved by using such fabrics as silk organza or tulle with raw torn edges in a utterly artful way. It is a style that when done with care may be rather striking and unique. Picking out a wedding gown is always a very particular time in a bride’ simple wedding dresses simple wedding dresses simple wedding dresses s life. The styles that are fresh off the runway are chic, interesting, red formal dresses and rather beautiful. No matter what your taste is, simple wedding dresses you are sure to find an unbelievable dress among the most recent creations for 2010. affordable cocktail dresses affordable cocktail dresses fall bridesmaids dresses Related Articles: 1.The Lowdown on Evening Dresses 2.Excellent Dresses For a Special Prom Party 3.Purple Bridesmaid Dresses 4.Go All Out Mit Petite Dresses! 5.Brautjunferkleider Rosa Brautjungfern Schuhe von skyvogue

Name

Url

Email

Comments

CAPTCHA Image Validation