{"id":61,"date":"2018-09-20T08:10:00","date_gmt":"2018-09-20T08:10:00","guid":{"rendered":"https:\/\/www.aladan.net\/MIMicry\/?p=61"},"modified":"2018-09-21T07:19:44","modified_gmt":"2018-09-21T07:19:44","slug":"criteria-based-sets-and-prior-to-today-evaluation-portal-vs-mim-service","status":"publish","type":"post","link":"https:\/\/www.aladan.net\/MIMicry\/2018\/09\/20\/criteria-based-sets-and-prior-to-today-evaluation-portal-vs-mim-service\/","title":{"rendered":"Criteria-based sets and &#8220;prior to today&#8221; evaluation in the Portal vs the MIM Service"},"content":{"rendered":"<p>So&#8230; maybe you have a set like this:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-62\" src=\"https:\/\/www.aladan.net\/MIMicry\/wp-content\/uploads\/2018\/09\/set-madness.jpg\" alt=\"\" width=\"784\" height=\"144\" srcset=\"https:\/\/www.aladan.net\/MIMicry\/wp-content\/uploads\/2018\/09\/set-madness.jpg 784w, https:\/\/www.aladan.net\/MIMicry\/wp-content\/uploads\/2018\/09\/set-madness-300x55.jpg 300w, https:\/\/www.aladan.net\/MIMicry\/wp-content\/uploads\/2018\/09\/set-madness-768x141.jpg 768w\" sizes=\"auto, (max-width: 784px) 100vw, 784px\" \/><\/p>\n<p>You might wonder exactly what &#8220;prior to today&#8221; actually means.\u00a0 Especially when it comes to timezone handling.\u00a0 And if you&#8217;re not wondering that, well you probably should be \ud83d\ude42<\/p>\n<p>First of all, remember that all your time DateTimes are (or at least should be) stored in UTC inside the MIM Service database.\u00a0 That&#8217;s the sensible approach, and the Portal will format your DateTimes correctly based on the configured timezone if you do.<\/p>\n<p>Anyway, back in the Portal and you&#8217;re clicking the &#8220;View Member&#8221; button.\u00a0 It&#8217;s not hard to work out that &#8220;prior to today&#8221; seems to actually mean &#8220;prior to now&#8221; there.\u00a0 Specifically, the UTC time in your attribute needs to be before the current UTC time.\u00a0 I&#8217;m not <em>specifically<\/em> sure if that&#8217;s the web browser&#8217;s UTC time or the server&#8217;s UTC time, but in any sensible environment they&#8217;ll be the same anyway.<\/p>\n<p>Here&#8217;s a quick look at the underlying Filter attribute to get a better understanding of that:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-63\" src=\"https:\/\/www.aladan.net\/MIMicry\/wp-content\/uploads\/2018\/09\/set-filter.jpg\" alt=\"\" width=\"597\" height=\"86\" srcset=\"https:\/\/www.aladan.net\/MIMicry\/wp-content\/uploads\/2018\/09\/set-filter.jpg 597w, https:\/\/www.aladan.net\/MIMicry\/wp-content\/uploads\/2018\/09\/set-filter-300x43.jpg 300w\" sizes=\"auto, (max-width: 597px) 100vw, 597px\" \/><\/p>\n<p>So it&#8217;s all about fn:current-dateTime().\u00a0 Cool.<\/p>\n<p>So far so sensible.\u00a0 Now we know that <strong>temporal sets<\/strong> like this only get re-evaluated when the FIM_MaintainSetsJob runs on the SQL server.\u00a0 And here&#8217;s where the pain sets in &#8211; a user with accessExtensionExpiryDate prior to the current time appeared as a member just fine in the Portal, but when I ran the SQL agent job to recalculate my set membership the user object didn&#8217;t get added to the set.<\/p>\n<p>After quite a bit of trial and error it appears that the SQL Agent job&#8217;s definition of &#8220;prior to now&#8221; is &#8220;before 1AM today in the local server time&#8221;.\u00a0 I can sort-of understand a decision to do the evaluation in local time &#8211; at some time someone decided that the job should just do the sensible thing, since &#8220;prior to today&#8221; inherently needs to know what &#8220;today&#8221; means, and using local server time is probably what MIM developers want, rather than &#8220;today&#8221; in the UTC sense.\u00a0 But the 1am threshold?\u00a0 That makes basically no sense to me.\u00a0 I can only guess it&#8217;s because FIM_MaintainSetsJob is configured to run at 1am by default.\u00a0 If that&#8217;s the case then hard-coding the definition of &#8220;today&#8221; to the time when a SQL job runs <em>by default<\/em> isn&#8217;t my idea of sensible programming \ud83d\ude41<\/p>\n<p>No wonder temporal sets cause headaches!<\/p>\n<p>Addendum: if you really want to see what&#8217;s in your Set, LithnetRMA is your friend:<\/p>\n<pre>(Search-Resources -XPath \"\/Set[DisplayName='My Lovely Set']\" -AttributesToGet @(\"ComputedMember\")).ComputedMember<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>So&#8230; maybe you have a set like this: You might wonder exactly what &#8220;prior to today&#8221; actually means.\u00a0 Especially when it comes to timezone handling.\u00a0 And if you&#8217;re not wondering that, well you probably should be \ud83d\ude42 First of all, remember that all your time DateTimes are (or at least should be) stored in UTC<span class=\"post-excerpt-end\">&hellip;<\/span><\/p>\n<p class=\"more-link\"><a href=\"https:\/\/www.aladan.net\/MIMicry\/2018\/09\/20\/criteria-based-sets-and-prior-to-today-evaluation-portal-vs-mim-service\/\" class=\"themebutton\">Read More<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,12,8,9,5],"tags":[],"class_list":["post-61","post","type-post","status-publish","format-standard","hentry","category-learnings","category-lithnet","category-mimservice","category-portal","category-ugly"],"_links":{"self":[{"href":"https:\/\/www.aladan.net\/MIMicry\/wp-json\/wp\/v2\/posts\/61","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.aladan.net\/MIMicry\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.aladan.net\/MIMicry\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.aladan.net\/MIMicry\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.aladan.net\/MIMicry\/wp-json\/wp\/v2\/comments?post=61"}],"version-history":[{"count":6,"href":"https:\/\/www.aladan.net\/MIMicry\/wp-json\/wp\/v2\/posts\/61\/revisions"}],"predecessor-version":[{"id":69,"href":"https:\/\/www.aladan.net\/MIMicry\/wp-json\/wp\/v2\/posts\/61\/revisions\/69"}],"wp:attachment":[{"href":"https:\/\/www.aladan.net\/MIMicry\/wp-json\/wp\/v2\/media?parent=61"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.aladan.net\/MIMicry\/wp-json\/wp\/v2\/categories?post=61"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.aladan.net\/MIMicry\/wp-json\/wp\/v2\/tags?post=61"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}