Advertisement
Guest User

fordi!

a guest
Feb 24th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
F# 1.05 KB | None | 0 0
  1. let getRoles =
  2.     makeRolesQuery
  3.     >> retrieveMultipleEntities
  4.     >> Seq.map (fun x -> RetrieveRolePrivilegesRoleRequest (RoleId = x.Id))
  5.     >> Seq.cast<OrganizationRequest>
  6.     >> makeTransactionRequest
  7.     >> executeTransactionPaged 100
  8.     >> Seq.collect (fun x -> x.Responses)
  9.     >> Seq.cast<RetrieveRolePrivilegesRoleResponse>
  10.     >> Seq.collect (fun x -> x.RolePrivileges)
  11.     >> Seq.groupBy (fun x -> x.PrivilegeId)
  12.     >> Seq.map (fun (_, x) ->
  13.         x
  14.         |> Seq.sortByDescending (fun y ->
  15.             LanguagePrimitives.EnumToValue y.Depth)
  16.         |> Seq.head)
  17.     >> fun x ->
  18.         let privileges =
  19.             x
  20.             |> Seq.map (fun y -> y.PrivilegeId)
  21.             |> makePrivilegesRequest
  22.             |> retrieveMultipleEntities
  23.  
  24.         x
  25.         |> Seq.map (fun y ->
  26.             let name =
  27.                 privileges
  28.                 |> Seq.find (fun z ->
  29.                     z.Id = y.PrivilegeId)
  30.                 |> getAttributeValue<string> "name"
  31.  
  32.             name, y.Depth)
  33.     >> Seq.sortBy fst
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement