{"id":3923,"date":"2013-07-02T07:00:00","date_gmt":"2013-07-02T07:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2013\/07\/02\/you-can-read-as-well-as-i-can-or-maybe-not\/"},"modified":"2013-07-02T07:00:00","modified_gmt":"2013-07-02T07:00:00","slug":"you-can-read-as-well-as-i-can-or-maybe-not","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20130702-00\/?p=3923","title":{"rendered":"You can read as well as I can, or maybe not"},"content":{"rendered":"<p>\nOccasionally, somebody will ask for help on a distribution list,\nand it turns into a really annoying case of hand-holding.\n<\/p>\n<blockquote CLASS=\"q\">\n<p>\n<b>From<\/b>: X\n<\/p>\n<p>\nI&#8217;m using the XYZ toolset to do some document management,\nand I want the server to run a script whenever somebody tries to\nmodify the master template,\nso it can run validations before accepting the update,\nsuch as verifying that the person making the change has\nreceived the proper approvals.\nIs that possible?\n<\/p>\n<\/blockquote>\n<p>\nIt turns out that this is something the XYZ toolset already\nknows how to do.\n<\/p>\n<blockquote CLASS=\"q\">\n<p>\n<b>From<\/b>: Raymond\n<\/p>\n<p>\nYou can create a <code>conditions<\/code> configuration file\nwhich adds a condition that validates that the request\nsatisfies whatever conditions you require.\n<\/p>\n<\/blockquote>\n<blockquote CLASS=\"q\">\n<p>\n<b>From<\/b>: X\n<\/p>\n<p>\nYes, that is what I am looking for.\nWhere can I find information on how to write the validation\nscript and how to implement it on the server?\n<\/p>\n<\/blockquote>\n<blockquote CLASS=\"q\">\n<p>\n<b>From<\/b>: Raymond\n<\/p>\n<p>\nOn http:\/\/xyztoolset\/, go to <i>Server setup<\/i>,\nthen <i>Conditions<\/i>.\n<\/p>\n<\/blockquote>\n<p>\nAnother colleague with a lot of experience with the XYZ toolset\nstepped in with some more useful advice:\n<\/p>\n<blockquote CLASS=\"q\">\n<p>\n<b>From<\/b>: A\n<\/p>\n<p>\nInstead of developing scripts from scratch, you may want to\nstart with the pre-written scripts that come with the XYZ toolset\nadd-on pack.\nThere are already modules for things like scanning the\n<i>Description<\/i> field for approval IDs.\nNote also that you may want to include some way of changing\nthe rules dynamically as your processes change\n(for example, maybe one of the approvers goes on vacation and\ndelegates approval authority to somebody else,\nor maybe your project goes into a &#8220;no approval necessary&#8221; phase)\nrather than just hard-coding the rules.\n<\/p>\n<\/blockquote>\n<blockquote CLASS=\"q\">\n<p>\n<b>From<\/b>: X\n<\/p>\n<p>\nThat&#8217;s a good idea.\nIs there a way to easily disable a validation script?\n<\/p>\n<\/blockquote>\n<blockquote CLASS=\"q\">\n<p>\n<b>From<\/b>: Raymond\n<\/p>\n<p>\nUm, you can just\n<a HREF=\"http:\/\/blogs.msdn.com\/b\/oldnewthing\/archive\/2009\/08\/04\/9856634.aspx\">\nbuild this into your validation script<\/a>.\n<\/p>\n<pre>\nif (File.Exists(@\"\\\\project\\admin\\no_validation\")) {\n   return Validation.Passed;\n}\n<\/pre>\n<\/blockquote>\n<blockquote CLASS=\"q\">\n<p>\n<b>From<\/b>: A\n<\/p>\n<p>\nOr you can have a magic word in the <i>Description<\/i> that\ndisables validation.\nFeatures like this and the one Raymond describes are available\nin the add-on pack.\nLook in the <code>Sentinel<\/code> and <code>Description&shy;Match<\/code>\nmodules.\n<\/p>\n<\/blockquote>\n<blockquote CLASS=\"q\">\n<p>\n<b>From<\/b>: X\n<\/p>\n<p>\nI&#8217;m having trouble getting this working.\nThe documentation says I should do something like\n<\/p>\n<pre>\n&lt;condition file=\"$\\path\\to\\file.ext\"\n           action=\"C:\\path\\to\\validate.xyz\" \/&gt;\n<\/pre>\n<p>\nIf I use a shared network path for my validation script,\nI get &#8220;access denied&#8221;.\n<\/p>\n<pre>\n&lt;condition file=\"$\\Nosebleed\\MasterTemplate.xml\"\n           action=\"\\\\project\\admin\\validate.xyz\" \/&gt;\n<\/pre>\n<p>\nIf I use an internal path:\n<\/p>\n<pre>\n&lt;condition file=\"$\\Nosebleed\\MasterTemplate.xml\"\n           action=\"$\\Scripts\\validate.xyz\" &gt;\n<\/pre>\n<p>\nI get &#8220;file not found&#8221;.\nI added $\\Scripts\\validate.xyz to the document repository,\nso the server should be able to see it.\nAm I missing something obvious here?\n<\/p>\n<\/blockquote>\n<p>\n(I like how this person just made up a feature,\nin this case, using a repository path as an action\nrather than a physical file path.)\n<\/p>\n<blockquote CLASS=\"q\">\n<p>\n<b>From<\/b>: Raymond\n<\/p>\n<p>\nMy psychic powers tell me that the account under which the\nserver is running does not have access to\n<code>\\\\project\\admin\\validate.xyz<\/code>.\nAnd adding the validation script to the document repository\nallows the server to access it only if <i>the server\nhas an active (and up-to-date) workspace joined to the repository<\/i>.\nSure the server has a copy of validate.xyz, but that copy\nis in the repository <i>database<\/i>.\n(Adding a file to the repository is more than just a &#8220;copy&#8221; operation.)\n<\/p>\n<p>\nI would not be surprised if having the server also maintain\na live workspace in itself is not a recommended practice.\n<\/p>\n<\/blockquote>\n<blockquote CLASS=\"q\">\n<p>\n<b>From<\/b>: X\n<\/p>\n<p>\nI agree with your assessment of the &#8220;access denied&#8221; issue,\nbut I really don&#8217;t want the validate.xyz script to reside\non an external share.\nWhere is the best place to put the script?\nOn the server or a share?\n<\/p>\n<\/blockquote>\n<blockquote CLASS=\"q\">\n<p>\n<b>From<\/b>: Raymond\n<\/p>\n<p>\nThe documentation for the XYZ add-on pack recommends\nputting the scripts on the server,\naccessible via a share.\n<\/p>\n<\/blockquote>\n<blockquote CLASS=\"q\">\n<p>\n<b>From<\/b>: X\n<\/p>\n<p>\nBut that&#8217;s what I did, and the result was &#8220;access denied.&#8221;\n<\/p>\n<\/blockquote>\n<blockquote CLASS=\"q\">\n<p>\n<b>From<\/b>: Raymond\n<\/p>\n<p>\nNo, that&#8217;s not what you did.\nThe recommendation is to put the scripts on the server\n(C:\\Scripts\\validate.xyz) and then share out your scripts\n(net share Scripts=C:\\Scripts) so administrators can update\nthem remotely.\n<\/p>\n<\/blockquote>\n<blockquote CLASS=\"q\">\n<p>\n<b>From<\/b>: X\n<\/p>\n<p>\nI read the XYZ Toolkit documentation for <code>conditions<\/code>,\nand it says\n&#8220;Get an IT-managed share created.&#8221;\nI suppose I need to contact the IT department to have that done.\nCorrect?\n<\/p>\n<\/blockquote>\n<p>\nAt this point, I got tired of hand-holding.\n<\/p>\n<blockquote CLASS=\"q\">\n<p>\n<b>From<\/b>: Raymond\n<\/p>\n<p>\nYou can read just as well as I can.\n<\/p>\n<\/blockquote>\n<p>\nPrivately, I sent a message to <i>A<\/i>:\n<\/p>\n<blockquote CLASS=\"q\">\n<p>\n<b>From<\/b>: Raymond<br \/>\n<b>To<\/b>: A\n<\/p>\n<blockquote STYLE=\"border-left: solid black .75pt;padding-left: 1em\"><p>\nYou can read just as well as I can.\n<\/p><\/blockquote>\n<p>\nActually, that statement is a lie.\n<\/p>\n<\/blockquote>\n<p>\nMy colleague &#8220;A&#8221; replied,\n&#8220;Yes, I thought that to myself when you used that line last week, too!&#8221;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Occasionally, somebody will ask for help on a distribution list, and it turns into a really annoying case of hand-holding. From: X I&#8217;m using the XYZ toolset to do some document management, and I want the server to run a script whenever somebody tries to modify the master template, so it can run validations before [&hellip;]<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[26,106],"class_list":["post-3923","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-other","tag-the-social-skills-of-a-thermonuclear-device"],"acf":[],"blog_post_summary":"<p>Occasionally, somebody will ask for help on a distribution list, and it turns into a really annoying case of hand-holding. From: X I&#8217;m using the XYZ toolset to do some document management, and I want the server to run a script whenever somebody tries to modify the master template, so it can run validations before [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/3923","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=3923"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/3923\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=3923"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=3923"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=3923"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}