⚠️ This lesson is retired and might contain outdated information.

Expose IBM Domino User Information as JSON

Mark Barton
InstructorMark Barton
Share this video with your friends

Social Share Links

Send Tweet
Published 6 years ago
Updated a year ago

This lesson will demonstrate how to use simple Domino design elements like a page and @formulas to output a logged in users application roles and registered name.

This additional information is passed to a client application via the Node.js application. These roles could then be used to control visibility of user interface elements.

Instructor: [00:00] To get more user information from Domino, including what roles the user has, I find the easiest way is to create a simple page. I'm using a page because a form it has new fields required on this. We're going to call the page User. I'm storing this page inside my demo database.

[00:16] The first thing we want to do is change the MIME type for the page so that it returns JSON data. Then, we're going to use simple computed values. We'll start with a user object. We'll use a string [inaudible] here. This object will have two properties. It'll have the user name, and for this computed value, we'll use a simple @UserName, and we'll wrap it with a @name so we get the common name.

[00:53] Then, our second property will be roles. This could be a multivalue, so it's going to potentially be an array. We want to remove the square brackets and the dollar [inaudible] that Domino will automatically send. We'll start with a temporary variable. We'll add a trim and an @replace substring.

[01:13] We're going to work on user roles. We'll remove one square bracket, the other square bracket, and $$ workline, and we're going to replace those with empty quotes. If we don't have any roles, then we want to return a blank value, else we want to implode them and wrap them in string quotes.

[01:41] We'll escape that. We'll use a comma as a string delimiter, because that's what the JavaScript array delimiter is. We will now test that in the browser. I've opened my database and opened my user page in the browser. First one I get is the standard Domino login, because it's a secure database.

[02:00] I sign in. I then get back the JSON data that we've defined using the computed values. My test user actually has those roles. They're listed here in the ACL. Let's go forward and use those within our application.

egghead
egghead
~ 38 minutes ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today