SharePoint జాబితా / డాక్యుమెంట్ లైబ్రరీ అభిప్రాయాలు సురక్షితంగా ఉంది (విధమైన) J క్వెరీ తో సాధ్యం

ఈ నా మరొక టపా సిరీస్ కొనసాగుతున్న ఎలా ఉపయోగించాలో న j క్వెరీ SharePoint తో.
మీరు j క్వెరీ గురించి మరింత తెలుసుకోవడానికి అనుకొంటే, నేను అత్యంత సిఫార్సు: యాక్షన్ లో j క్వెరీ బేర్ Bibeault మరియు యెహుదా కాట్జ్ ద్వారా.

నేను భావించాను మొదటి విషయాలు ఒకటి, ఒకసారి నేను j క్వెరీ తో చుట్టూ ప్లే చేయడం ప్రారంభించాడు, 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: త్వరిత మరియు సులువు: SharePoint కోసం మీ స్వంత j క్వెరీ శాండ్బాక్స్ సృష్టించు.

ఒక దృశ్యం "సురక్షిత" కు, ఈ దశలను అనుసరించండి:

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

    ఇది "సురక్షితం" కాదు ఉన్నప్పుడు కనిపిస్తుంది ఏమిటి:

    image

  2. Sandbox ఆర్టికల్ లో వివరించిన ట్రిక్ ఉపయోగించి వీక్షణ యొక్క పేజీకి కంటెంట్ ఎడిటర్ వెబ్ భాగం జోడించు (ఉదా. "పేజీ వీక్షణ = షేర్డ్ జోడించండి&URL కు ToolPaneView = 2 ").
  3. Figure out your SharePoint _spUserId by following these crazy steps, నమ్మకం లేదా:
    1. మీ SharePoint వాతావరణంలో లాగిన్.
    2. వెబ్ బ్రౌజర్ యొక్క చిరునామా ఫీల్డ్లో, రకము: "జావాస్క్రిప్ట్:హెచ్చరించు(_spUserId ").
    3. ఫలితంగా రికార్డ్ (ఇది నా విషయంలో "13" వార్తలు).

      image

  4. కోడ్ లో మీ CEWP కింది javascript జోడించు:

    <లిపి
        "text/javascript"
        src ="../../jQuery Library/jquery-1.3.2.min.js">
    </లిపి>
    
    <స్క్రిప్ట్ రకం ="text/javascript">
      $(ఫంక్షన్() {
    
        హెచ్చరించు(_spUserId);
    
        ఉంది theSecuredView = $('Iframe[FilterLink * = సురక్షిత% 20View]');
    
        అయితే ((theSecuredView.length > 0) && (_spUserId == 13))
          $('Iframe[FilterLink * = సురక్షిత% 20View]').మాతృ().మాతృ().మాతృ().html("<tr bgcolor = ఎరుపు><td>మీకు వీక్షణ!</td></tr>");
      });
    
    </లిపి>
    

నేను చేర్చాను ఆ హెచ్చరిక(_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 View” in its value. Once it finds it, we check to see if the current user is “13”. If it is, మేము ఒక కు DOM నడిచి <TR> ట్యాగ్ (ఇది నేను మూలాన్ని వీక్షించేందుకు మరియు ట్రేసింగ్ ద్వారా పరిష్కరించిన) అప్పుడు నా సందేశం ఆ TR ట్యాగ్ స్థానంలో. నేను నిజంగా ఈ ఎలా బలమైన తెలియదు (నేను చాలా అనుమానాస్పద రెడీ, నిజానికి), but it worked in my sandbox. If I find a better way, నేను దాని గురించి బ్లాగ్ చేస్తాను. ఈ ఫలితం:

image

నేను OK బటన్ క్లిక్ చేయండి మరియు డేటా పెద్ద ఎర్ర సందేశాన్ని ఆక్రమించటం:

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, ఒక తెలివైన వినియోగదారు అన్ని వద్ద పరుగు j క్వెరీ నిరోధించడానికి మరియు అతను / ఆమె చూడండి కోరుకుంటున్నారు ఏమి చూడగలరు.

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. కొన్నిసార్లు, తగినంత మంచి వార్తలు.

అదృష్టాన్ని, నేను కాలానుగుణంగా ఈ విషయం మీద వ్రాయడానికి మరింత ఉంటుంది.

</చివర>

నా బ్లాగ్ సబ్స్క్రయిబ్.

వద్ద ట్విట్టర్ లో నన్ను అనుసరించండి http://www.twitter.com/pagalvin

ఒక Reply వదిలి

మీ ఇమెయిల్ చిరునామా ప్రచురితమైన కాదు. లు గుర్తించబడతాయి *