CQ works great for me now. I really like what you have done with making it 
easier to exploring files.

A link to a document's permissions might be a nice thing to display as well as 
the link to its properties. Below is some code I have used to display document 
privileges.

xquery version "0.9-ml"

(:
 : Retrieves the permissions of all files and folders within a specified folder
 : It recursively descends through all subfolders below the starting folder.
 :)

import module namespace sec = "http://marklogic.com/xdmp/security"; at 
"/MarkLogic/security.xqy"


(: return an element listing all the permissions assigned to a document :)
define function get-permissions
(
  $doc as xs:string
) as element()*
{
  let $perm   := xdmp:document-get-permissions($doc)
  let $rid := distinct-values($perm//sec:role-id)
  for $i in $rid
  let $role := get-role-name-from-id($i)
  order by $role
  return
   element role
   {
    ( attribute privs
      {
       for $p in $perm[./sec:role-id = $i]
       order by $p/./sec:capability
       return
         data($p/./sec:capability)
      }
    )
   , attribute role  { $role }
   , attribute id {$i}
   }
}



(: return the role name from a role id :)
define function get-role-name-from-id
(
  $p as xs:unsignedLong
) as element(sec:role-name)*
{
  let $s :=
  '
    define variable $p as xs:unsignedLong external
    import module namespace sec = "http://marklogic.com/xdmp/security"; at 
"/MarkLogic/security.xqy"
    sec:get-role-names( $p )
  '
  return
    xdmp:eval
    (
      $s
     ,( xs:QName("p"), $p )
     , <options xmlns="xdmp:eval">
        <database>{xdmp:database("Security")}</database>
       </options>
    )
}


(: Retrieve the permissions for files starting with the directory in 
$starting-folder :)
define function get-file-permissions
(
  $starting-folder as xs:string
) as element()*
{
 <files>
 {
  for $d in fn:doc()
  let $u := xdmp:node-uri($d)
  order by $u
  return
  <file url="{$u}">
  {
     get-permissions($u)
  }
  </file>
 }
 </files>
}


(: Retrieve the permissions for folders starting with the directory in 
$starting-folder :)
define function get-folder-permissions
(
  $starting-folder as xs:string
) as element()*
{
 <folders>
 {
  for $d in xdmp:document-properties()/prop:properties/prop:directory
  let $u := xdmp:node-uri($d)
  where starts-with($u, $starting-folder)
  order by $u
  return
  <folder url="{$u}">
  {
     get-permissions($u)
  }
  </folder>
 }
 </folders>
}


(: Set the value of $starting-folder to limit the files and folders returned :)
<permissions>
{
 let $starting-folder := ""
 return
 (
    get-folder-permissions($starting-folder)
  , get-file-permissions($starting-folder)
 )
}
</permissions>



-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Michael Blakeley
Sent: Thursday, September 25, 2008 10:58 AM
To: General Mark Logic Developer Discussion
Subject: [MarkLogic Dev General] cq 4.0-1.1 [ was Re: CQ v4.0.1 Error. Occurs 
when pushing the explore link. ]

I was able to reproduce this problem on a fresh install of 4.0-1 on
Windows. The patch from my last message fixed it, so I've incorporated
that change in
http://developer.marklogic.com/svn/cq/releases/mark-logic-cq-4.0-1.1.zip
and withdrawn the previous release.

-- Mike

Michael Blakeley wrote:
> Thanks for the additional information. Oddly, my test configuration is
> exactly as you describe: cq is unpacked in the Docs directory, so when
> explore.xqy calls xdmp:invoke, the root path is 'Docs/'. I don't yet
> understand why this works for me, but not for you or for Mike Bowers.
>
> If you're comfortable with diff and patch, here's a possible fix. With
> this change, cq attempts to figure out where it has been installed, and
> uses that path as the root for explore-invokable.xqy. It works for me,
> but so did the 4.0.1 technique :-).
>
> -- Mike
>
> Wyatt VanderStucken wrote:
>> Michael,
>>
>> I'm able to reproduce this also.  I don't think it's Linux vs. Windows,
>> but rather where cq is deployed.  I have cq deployed to
>> <MLS_DIR>/Docs/cq/ within an app whose root is set to "Docs/".  The
>> problem lies in explore.xqy - explore-invokable.xqy needs to be invoked
>> relative to explore.xqy...
>>
>> return xdmp:invoke(
>>   'explore-invokable.xqy',
>>   (xs:QName('START'), $START, xs:QName('SIZE'), $SIZE,
>>    xs:QName('FILTER-TEXT'), $FILTER-TEXT,
>>    xs:QName('FILTER'),
>>    if (not($filter)) then '' else xdmp:quote(document { $filter })
>>   ),
>>   $OPTIONS
>> )
>>
>> That's as far as my debugging has gotten - off to a meeting...
>>
>> Thanks,
>> Wyatt
>>
>>
>>
>> Michael Blakeley wrote:
>>> Mike,
>>>
>>> Thanks for the report. I'm having trouble reproducing this error on
>>> Linux: that may mean that it's a Windows-specific error, so I'll have
>>> to try a Windows machine.
>>>
>>> Meanwhile, you should be able to cq 3.2.4 with MarkLogic Server 4.0-1.
>>>
>>> -- Mike
>>>
>>> Mike Bowers wrote:
>>>> CQ v4.0.1 Error. Occurs when pushing the explore link. The MarkLogic
>>>> database against which CQ is running is a freshly installed instance
>>>> of v4.0-1. Below is the error message displayed in CQ.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> 500 Internal Server Error
>>>>
>>>> SVC-FILOPN: xdmp:invoke("explore-invokable.xqy", (QName("", "START"),
>>>> 1, QName("", "SIZE"), ...), <options
>>>> xmlns="xdmp:eval"><database>17830873724881344990</database><root>Docs</root><modul...</options>)
>>>> -- File open error: open 'Docs\explore-invokable.xqy': No such file
>>>> or directory
>>>>
>>>> in /cq/explore.xqy, on line 65 [1.0-ml]
>>>>
>>>> $filter = ()
>>>>
>>>> $filter = ()
>>>>
>>>> ----------------------------------------------------------------------
>>>> NOTICE: This email message is for the sole use of the intended
>>>> recipient(s) and may contain confidential and privileged information.
>>>> Any unauthorized review, use, disclosure or distribution is
>>>> prohibited. If you are not the intended recipient, please contact the
>>>> sender by reply email and destroy all copies of the original message.
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------
>>>>
>>>> _______________________________________________
>>>> General mailing list
>>>> [email protected]
>>>> http://xqzone.com/mailman/listinfo/general
>>> _______________________________________________
>>> General mailing list
>>> [email protected]
>>> http://xqzone.com/mailman/listinfo/general
>> _______________________________________________
>> General mailing list
>> [email protected]
>> http://xqzone.com/mailman/listinfo/general
>
>

_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

----------------------------------------------------------------------
NOTICE: This email message is for the sole use of the intended recipient(s) and 
may contain confidential and privileged information. Any unauthorized review, 
use, disclosure or distribution is prohibited. If you are not the intended 
recipient, please contact the sender by reply email and destroy all copies of 
the original message.
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to