શેરપોઈન્ટ યાદી આપો / દસ્તાવેજ લાઇબ્રેરી જોવાઈ સુરક્ષા લાગે છે (પ્રકારની) JQuery સાથે શક્ય

આ મારા બીજા પોસ્ટ છે શ્રેણી ચાલુ કેવી રીતે ઉપયોગ jQuery શેરપોઈન્ટ સાથે.
તમે jQuery વિશે વધુ જાણવા માંગો છો, તો, હું ખૂબ આગ્રહ રાખીએ છીએ: ઍક્શન માં jQuery બેર Bibeault અને Yehuda કેટ્ઝ દ્વારા.

હું માનવામાં પ્રથમ વસ્તુઓ એક, એક વખત હું jQuery સાથે આસપાસ રમવા માટે શરૂ, was whether we could use it to secure a SharePoint view. The answer is “no” (અથવા ઓછામાં ઓછા, હું તે શક્ય છે અને દાવો કર્યો નથી). તેમ છતાં, it is certainly possible to make it difficult for people to see a particular view.

I started with my sandbox environment when working on this. I wrote about that environment here: ઝડપી અને સરળ: શેરપોઈન્ટ માટે તમારી પોતાની jQuery સેન્ડબોક્સ બનાવો.

એક દૃશ્ય "સુરક્ષિત" માટે, આ પગલાંઓ અનુસરો:

  1. Create a view you want to secure. I did that and called it “Secured View”.

    આ તે "સુરક્ષિત" નથી ત્યારે એવું લાગે છે કે શું છે:

    image

  2. આ સેન્ડબોક્સ લેખ માં વર્ણવાયેલ યુક્તિ મદદથી જુઓ માતાનો પાનું માટે સામગ્રી સંપાદક વેબ ભાગ ઉમેરો (દાખલા તરીકે. "પૃષ્ઠદૃય = વહેંચાયેલ ઉમેરો&આ URL પર ToolPaneView = 2 ").
  3. Figure out your SharePoint _spUserId by following these crazy steps, માને નથી અથવા:
    1. તમારા શેરપોઈન્ટ પર્યાવરણ પ્રવેશ કરો.
    2. વેબ બ્રાઉઝર સરનામાં ક્ષેત્ર ઈંચ, પ્રકાર: "JavaScript:સજાગ(_spUserId ").
    3. પરિણામ રેકોર્ડ (તે મારા કિસ્સામાં "13" છે).

      image

  4. કોડ જુઓ તમારા CEWP માટે નીચેની JavaScript ઉમેરો:

    <લિપિ
        "text/javascript"
        src ="../../jQuery%20Library/jquery-1.3.2.min.js">
    </લિપિ>
    
    <સ્ક્રિપ્ટ પ્રકાર ="text/javascript">
      $(કાર્ય() {
    
        સજાગ(_spUserId);
    
        હતી theSecuredView = $('Iframe[FilterLink * = સુરક્ષીત% 20View]');
    
        જો ((theSecuredView.length > 0) && (_spUserId == 13))
          $('Iframe[FilterLink * = સુરક્ષીત% 20View]').પિતૃ().પિતૃ().પિતૃ().HTML("<ટીઆર bgcolor = લાલ><ટીડી>તમે માટે આ બોલ પર કોઈ દૃશ્ય!</ટીડી></ટીઆર>");
      });
    
    </લિપિ>
    

મેં સમાવેશ કર્યા છે કે ચેતવણી(_spUserId) આ ખરેખર એક દૃશ્ય "સુરક્ષિત" નથી કેવી રીતે દર્શાવવા માટે ત્યાં રેખા, but simply making it more difficult to see. More on that in a moment.

મૂળભૂત રીતે, jQuery is looking for an iFrame on the page who has an attribute that contains “Secured%20View” in its value. Once it finds it, we check to see if the current user is “13”. If it is, અમે માટે DOM અપ જવામાં <TR> ટેગ (જે હું સ્ત્રોત જોઈ અને તે ટ્રેસીંગ દ્વારા બહાર figured) અને પછી મારા સંદેશ સાથે કે TR ટૅગ બદલી. હું ખરેખર આ કેવી રીતે મજબૂત છે ખબર નથી (હું ખૂબ જ શંકાસ્પદ છું, હકીકતમાં), but it worked in my sandbox. If I find a better way, હું તે વિશે બ્લોગ પડશે. આ પરિણામ છે:

image

હું બરાબર બટન પર ક્લિક કરો અને આ માહિતી મોટા લાલ મેસેજ સાથે બદલાઈ જાય છે:

image

તમે કહી શકો છો, the way I’ve implement this “security” solution is to allow the web part to render itself. After it finishes, હું તમને મારા માટે "કોઈ દૃશ્ય સાથે તેની સામગ્રી પર ફરીથી લખી!"સંદેશ.

તે ખરેખર એક "સુરક્ષિત" દૃશ્ય નથી તે હકીકત છતાં, તે સંભવિત ઉપયોગી અને કેટલાક હોંશિયાર સાથે કામ છે, it may eventually be securable in a more formal sense. The fundamental issue is that the client is getting all the data and then, તે માહિતી નહીં પછી જ, it wipes it out. If the client is getting the data, એક ચપળ વપરાશકર્તા બધા પર ચાલતું ના jQuery અટકાવવા અને તે / તેણી જોવા ઇચ્છે છે તે જોઈ શકો છો.

There are other drawbacks. This “security” approach is based off a _spUserId. We’d want to really secure based on the full SharePoint security model, or at least by user name. That becomes progressively harder, પરંતુ હું આ વિષય પર લખેલા કેટલાક સારા સામગ્રી જુઓ, તેથી હું કે સમસ્યા માટે આ બોલ પર કોઈ જવાબ નથી આશાવાદી છું.

પોતાને trimmed જોઈએ જોવાઈ યાદી, જો શક્ય હોય તો. I haven’t tried to figure that out. I assume it’s possible, કોઈને પણ માત્ર તેઓ માંગો છો તે દ્રશ્ય URL ટાઇપ કરી શકે છે કારણ કે, પરંતુ ખરેખર મૂળભૂત સુરક્ષા સમસ્યા હલ નથી (તેઓ જાણતા હતા તે તો). તેમ છતાં, trimming makes sense. It’s a good usability feature and it helps to obfuscate things. If an end user doesn’t know that the view event exists, they probably won’t try to use it. ક્યારેક, તે પર્યાપ્ત સારી છે.

નસીબ સાથે, હું સમય પર આ વિષય પર લખવાનું વધુ પડશે.

</અંત>

મારા બ્લોગ પર સબ્સ્ક્રાઇબ કરો.

Twitter પર મને ખાતે અનુસરો http://www.twitter.com/pagalvin

del.icio.us ટૅગ્સ: ,,

જવાબ છોડો

તમારું ઇમેઇલ સરનામું પ્રકાશિત કરવામાં આવશે નહીં. જરૂરી ક્ષેત્રો ચિહ્નિત થયેલ છે *