{"id":48,"date":"2009-04-17T14:54:27","date_gmt":"2009-04-17T19:54:27","guid":{"rendered":"http:\/\/pierrekiroule.com\/?p=48"},"modified":"2009-04-23T22:20:42","modified_gmt":"2009-04-24T03:20:42","slug":"real-life-experience-displaying-dm-access-control-list-in-crystal-report","status":"publish","type":"post","link":"http:\/\/pierrekiroule.com\/?p=48","title":{"rendered":"Real life experience: displaying DM access control list in Crystal Report"},"content":{"rendered":"<p>A good thing about consulting is that I&#8217;m now exposed to real life report requests and different technologies to create them.<\/p>\n<p>This let me compare these technologies in situations outside of the &#8220;demo database boundaries&#8221;.<\/p>\n<p>Here is an example of useful feature found in Crystal Report XI:<\/p>\n<p>Crystal Report has a powerful formula workshop, which allows the creation of complex fields based on business rules that are not necessarily included in the database.<\/p>\n<p>For instance, our Document Management system stores the access control information about a document in a single numeric field. Creating a report that shows &#8220;45&#8221;\u00a0 or &#8220;63&#8221; as the only information about the access control is quite meaningless for a business user.<\/p>\n<p>The only place I could find some information about the meaning of this numbers was in the DM database documentation:<\/p>\n<p>The ACL is a combination of basic controls which each have a number (1, 2, 4, 8, 16, 32, 64, 128, 256 and 512): substract from the actual ACL number the list value just bellow it until you reach 0 in order to rebuild a list of these basic controls:<\/p>\n<p>for instance, &#8220;45&#8221; = &#8220;32&#8221; + &#8220;8&#8221; + &#8220;4&#8221; + &#8220;1&#8221;, so an ACL value of &#8220;45&#8221; means that the specified user has the combination of these basic controls (1, 4, 8 and 32) on the document.<\/p>\n<p>SQL doesn&#8217;t provide the ability to rebuild this kind of logic with its set of functions, and creating a calculated field in the database is not often an option.<\/p>\n<p>Using the Crystal Reports editor, I easily added a formula with a simple VB code (I had no previous experience of VB):<\/p>\n<p>[cc lang=&#8221;vb&#8221; theme=&#8221;default&#8221; width=&#8221;560&#8243;]<br \/>\n&#8216; Declaring array variables: aMsg for the actual basic controls, and aID for the control numbers.<br \/>\n&#8216; This is not really necessary, but I thought this would make the code cleaner,<br \/>\n&#8216; and somehow thought I could automate this loop a bit more \ud83d\ude42<br \/>\nDim aMsg(10) As String<br \/>\naMsg(1) = &#8221; View Profile |&#8221;<br \/>\n&#8230;<br \/>\naMsg(10) = &#8221; View Only Published |&#8221;<\/p>\n<p>Dim aID(10) As Number<br \/>\naID(1) = 1<br \/>\n&#8230;<br \/>\naID(10) = 512<\/p>\n<p>&#8216; Declaring the working variables:<br \/>\n&#8216; &#8211; the actual ACL for the document is initialized with the value from the database<br \/>\n&#8216; &#8211; the actual meaning of this number is initialized as a blank message.<\/p>\n<p>Dim aCurrentID As Number<br \/>\naCurrentID = {SECURITY.ACCESSRIGHTS}<br \/>\nDim aCurrentMsg As String<br \/>\naCurrentMsg = &#8220;&#8221;<\/p>\n<p>&#8216; In some odd cases, someone specifically &#8220;denies access&#8221;\u00a0 to a document, which is a different logic.<br \/>\n&#8216; As this is quite uncommon in our set up,<br \/>\n&#8216; and as the logic is not described in the documentation, I avoid checking these values.<\/p>\n<p>if aCurrentID &gt; 1023 Then aCurrentMsg = &#8220;More investigation required &#8211; Deny applied&#8221; : aCurrentID = 0<\/p>\n<p>&#8216; Start of the loop to rebuild the full access control list: the actual ACL value will be compared to the regular list<br \/>\n&#8216; and when it&#8217;s value is bellow a regular item, we add this regular control to the list, and decrease the ACL value<br \/>\n&#8216; until we reach 0.<br \/>\n&#8216; Note: the &#8220;:&#8221; separates the 2 actions in one line.<\/p>\n<p>While aCurrentID &gt; 0<\/p>\n<p>if aCurrentID &lt; aID(10) Then _<br \/>\n&#8230;<br \/>\nif aCurrentID &lt; aID(1) Then _<br \/>\naCurrentMsg = aCurrentMsg _<br \/>\nelse _<br \/>\naCurrentMsg = aCurrentMsg &amp; aMsg(1) : aCurrentID = aCurrentID &#8211; aID(1) _<br \/>\n&#8230;<br \/>\nelse _<br \/>\naCurrentMsg = aCurrentMsg &amp; aMsg(10) : aCurrentID = aCurrentID &#8211; aID(10)<\/p>\n<p>wend<\/p>\n<p>&#8216; The resulting aCurrentMsg is the combination of all the controls included in the original ACL value<br \/>\n&#8216; and passed as the result of the formula<br \/>\nformula = aCurrentMsg<br \/>\n[\/cc]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A good thing about consulting is that I&#8217;m now exposed to real life report requests and different technologies to create them. This let me compare these technologies in situations outside of the &#8220;demo database boundaries&#8221;. Here is an example of useful feature found in Crystal Report XI: Crystal Report has a powerful formula workshop, which [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[5],"tags":[],"class_list":["post-48","post","type-post","status-publish","format-standard","hentry","category-tech-tips"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Real life experience: displaying DM access control list in Crystal Report - Pierrekiroule Consulting<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/pierrekiroule.com\/?p=48\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Real life experience: displaying DM access control list in Crystal Report - Pierrekiroule Consulting\" \/>\n<meta property=\"og:description\" content=\"A good thing about consulting is that I&#8217;m now exposed to real life report requests and different technologies to create them. This let me compare these technologies in situations outside of the &#8220;demo database boundaries&#8221;. Here is an example of useful feature found in Crystal Report XI: Crystal Report has a powerful formula workshop, which [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"http:\/\/pierrekiroule.com\/?p=48\" \/>\n<meta property=\"og:site_name\" content=\"Pierrekiroule Consulting\" \/>\n<meta property=\"article:published_time\" content=\"2009-04-17T19:54:27+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2009-04-24T03:20:42+00:00\" \/>\n<meta name=\"author\" content=\"alex\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"alex\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"http:\\\/\\\/pierrekiroule.com\\\/?p=48#article\",\"isPartOf\":{\"@id\":\"http:\\\/\\\/pierrekiroule.com\\\/?p=48\"},\"author\":{\"name\":\"alex\",\"@id\":\"http:\\\/\\\/pierrekiroule.com\\\/#\\\/schema\\\/person\\\/613b1f79b5ac05eaf12fb6ce8a0dd70d\"},\"headline\":\"Real life experience: displaying DM access control list in Crystal Report\",\"datePublished\":\"2009-04-17T19:54:27+00:00\",\"dateModified\":\"2009-04-24T03:20:42+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\\\/\\\/pierrekiroule.com\\\/?p=48\"},\"wordCount\":536,\"commentCount\":1,\"articleSection\":[\"Tech tips\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"http:\\\/\\\/pierrekiroule.com\\\/?p=48#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"http:\\\/\\\/pierrekiroule.com\\\/?p=48\",\"url\":\"http:\\\/\\\/pierrekiroule.com\\\/?p=48\",\"name\":\"Real life experience: displaying DM access control list in Crystal Report - Pierrekiroule Consulting\",\"isPartOf\":{\"@id\":\"http:\\\/\\\/pierrekiroule.com\\\/#website\"},\"datePublished\":\"2009-04-17T19:54:27+00:00\",\"dateModified\":\"2009-04-24T03:20:42+00:00\",\"author\":{\"@id\":\"http:\\\/\\\/pierrekiroule.com\\\/#\\\/schema\\\/person\\\/613b1f79b5ac05eaf12fb6ce8a0dd70d\"},\"breadcrumb\":{\"@id\":\"http:\\\/\\\/pierrekiroule.com\\\/?p=48#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\\\/\\\/pierrekiroule.com\\\/?p=48\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\\\/\\\/pierrekiroule.com\\\/?p=48#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\\\/\\\/pierrekiroule.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Real life experience: displaying DM access control list in Crystal Report\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\\\/\\\/pierrekiroule.com\\\/#website\",\"url\":\"http:\\\/\\\/pierrekiroule.com\\\/\",\"name\":\"Pierrekiroule Consulting\",\"description\":\"Enterprise Content Management and some BI\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\\\/\\\/pierrekiroule.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"http:\\\/\\\/pierrekiroule.com\\\/#\\\/schema\\\/person\\\/613b1f79b5ac05eaf12fb6ce8a0dd70d\",\"name\":\"alex\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d2a3e9653dd4a5f45e78f4390f032130d2fd46d378061d207874813c65296eb4?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d2a3e9653dd4a5f45e78f4390f032130d2fd46d378061d207874813c65296eb4?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d2a3e9653dd4a5f45e78f4390f032130d2fd46d378061d207874813c65296eb4?s=96&d=mm&r=g\",\"caption\":\"alex\"},\"sameAs\":[\"http:\\\/\\\/pierrekiroule.com\"],\"url\":\"http:\\\/\\\/pierrekiroule.com\\\/?author=2\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Real life experience: displaying DM access control list in Crystal Report - Pierrekiroule Consulting","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/pierrekiroule.com\/?p=48","og_locale":"en_US","og_type":"article","og_title":"Real life experience: displaying DM access control list in Crystal Report - Pierrekiroule Consulting","og_description":"A good thing about consulting is that I&#8217;m now exposed to real life report requests and different technologies to create them. This let me compare these technologies in situations outside of the &#8220;demo database boundaries&#8221;. Here is an example of useful feature found in Crystal Report XI: Crystal Report has a powerful formula workshop, which [&hellip;]","og_url":"http:\/\/pierrekiroule.com\/?p=48","og_site_name":"Pierrekiroule Consulting","article_published_time":"2009-04-17T19:54:27+00:00","article_modified_time":"2009-04-24T03:20:42+00:00","author":"alex","twitter_card":"summary_large_image","twitter_misc":{"Written by":"alex","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"http:\/\/pierrekiroule.com\/?p=48#article","isPartOf":{"@id":"http:\/\/pierrekiroule.com\/?p=48"},"author":{"name":"alex","@id":"http:\/\/pierrekiroule.com\/#\/schema\/person\/613b1f79b5ac05eaf12fb6ce8a0dd70d"},"headline":"Real life experience: displaying DM access control list in Crystal Report","datePublished":"2009-04-17T19:54:27+00:00","dateModified":"2009-04-24T03:20:42+00:00","mainEntityOfPage":{"@id":"http:\/\/pierrekiroule.com\/?p=48"},"wordCount":536,"commentCount":1,"articleSection":["Tech tips"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["http:\/\/pierrekiroule.com\/?p=48#respond"]}]},{"@type":"WebPage","@id":"http:\/\/pierrekiroule.com\/?p=48","url":"http:\/\/pierrekiroule.com\/?p=48","name":"Real life experience: displaying DM access control list in Crystal Report - Pierrekiroule Consulting","isPartOf":{"@id":"http:\/\/pierrekiroule.com\/#website"},"datePublished":"2009-04-17T19:54:27+00:00","dateModified":"2009-04-24T03:20:42+00:00","author":{"@id":"http:\/\/pierrekiroule.com\/#\/schema\/person\/613b1f79b5ac05eaf12fb6ce8a0dd70d"},"breadcrumb":{"@id":"http:\/\/pierrekiroule.com\/?p=48#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/pierrekiroule.com\/?p=48"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/pierrekiroule.com\/?p=48#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/pierrekiroule.com\/"},{"@type":"ListItem","position":2,"name":"Real life experience: displaying DM access control list in Crystal Report"}]},{"@type":"WebSite","@id":"http:\/\/pierrekiroule.com\/#website","url":"http:\/\/pierrekiroule.com\/","name":"Pierrekiroule Consulting","description":"Enterprise Content Management and some BI","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/pierrekiroule.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"http:\/\/pierrekiroule.com\/#\/schema\/person\/613b1f79b5ac05eaf12fb6ce8a0dd70d","name":"alex","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/d2a3e9653dd4a5f45e78f4390f032130d2fd46d378061d207874813c65296eb4?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/d2a3e9653dd4a5f45e78f4390f032130d2fd46d378061d207874813c65296eb4?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d2a3e9653dd4a5f45e78f4390f032130d2fd46d378061d207874813c65296eb4?s=96&d=mm&r=g","caption":"alex"},"sameAs":["http:\/\/pierrekiroule.com"],"url":"http:\/\/pierrekiroule.com\/?author=2"}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/prd6Q-M","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"http:\/\/pierrekiroule.com\/index.php?rest_route=\/wp\/v2\/posts\/48","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/pierrekiroule.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/pierrekiroule.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/pierrekiroule.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/pierrekiroule.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=48"}],"version-history":[{"count":17,"href":"http:\/\/pierrekiroule.com\/index.php?rest_route=\/wp\/v2\/posts\/48\/revisions"}],"predecessor-version":[{"id":86,"href":"http:\/\/pierrekiroule.com\/index.php?rest_route=\/wp\/v2\/posts\/48\/revisions\/86"}],"wp:attachment":[{"href":"http:\/\/pierrekiroule.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=48"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/pierrekiroule.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=48"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/pierrekiroule.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=48"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}