User Management Guide

CHAPTER 10

Framework Tag Library

This chapter provides reference information about the user management framework tags (FrameworkTag.jar).

For more information    For background information, see the chapter on using the exteNd Director tag libraries in Developing exteNd Director Applications.

 
Top of page

addUserToGroup

Description

Adds a specified user to a group.

Wrapping   This tag wraps the addMember() method on the EbiRealmGroupDelegate interface.

Syntax

  <prefix:addUserToGroup id="ID" userid="userid" groupid="groupid" />

Attribute

Required?

Request-time expression values supported?

Description

id

No

No

Specifies the name of the variable that will be used to store the result of the operation. If the operation is successful, this variable holds a value of true. If the operation fails, this variable holds a value of false.

If no value is specified, a default ID of addedusertogroup is used.

userid

Yes

Yes

Specifies the ID for the user to add.

groupid

Yes

Yes

Specifies the ID for the group to which the user will be added.

Example

  <% taglib uri="/fw" prefix="fw" %>
  ...
  <fw:addUserToGroup id="result" userid="User1" groupid="Group1" />
  <%=pageContext.getAttribute("result")%>

 
Top of page

createGroup

Description

Creates a new group.

Wrapping   This tag wraps the addGroup() method on the EboDirectoryManager interface.

Syntax

  <prefix:createGroup id="ID" groupid="groupid" />

Attribute

Required?

Request-time expression values supported?

Description

id

No

No

Specifies the name of the variable that will be used to store the result of the operation. If the operation is successful, this variable holds a value of true. If the operation fails, this variable holds the string Group already exists.

If no value is specified, a default ID of addedgroup is used.

groupid

Yes

Yes

Specifies the ID for the new group.

Example

  <% taglib uri="/fw" prefix="fw" %>
  ...
  <fw:createGroup id="result" groupid="Group1" />
  <%=pageContext.getAttribute("result")%>

 
Top of page

createUser

Description

Creates a new user and a new default profile for that user. This tag creates the new user in the realm that was specified in the configuration for the Directory subsystem.

Wrapping   This tag wraps the createUser() method on the EbiUserDelegate interface.

Syntax

  <prefix:createUser id="ID" userid="userid" password="password"firstname="firstname" lastname="lastname" emailaddress="emailaddress"/>

Attribute

Required?

Request-time expression values supported?

Description

id

No

No

Specifies the name of the variable that will be used to store the result of the operation. If the operation is successful, this variable holds a value of true. If the operation fails, an exception is thrown.

If no value is specified, a default ID of addeduser is used.

userid

Yes

Yes

Specifies the ID for the new user.

password

Yes

Yes

Specifies the password for the new user.

firstname

No

No

Specifies the first name for the new user.

lastname

No

No

Specifies the last name for the new user.

emailaddress

No

No

Specifies the e-mail address for the new user.

Example

  <% taglib uri="/fw" prefix="fw" %>
  ...
  <fw:createUser id="result" userid="User1" password="MyPassword" firstname="John" lastname="Smith"/>
  <%=pageContext.getAttribute("result")%>

 
Top of page

getGroupList

Description

Returns a list of groups for the framework. The objects returned are of type java.security.acl.Group. They can be cast to Group objects, or a more specific subclass if necessary.

Wrapping   This tag wraps the getGroups() method on the EbiDirectoryManager interface.

Syntax

  <prefix:getGroupList id="ID" iterate="iterate" />

Attribute

Required?

Request-time expression values supported?

Description

id

No

No

Specifies the name of the variable that will be used to store the list of groups.

If no value is specified, a default ID of grouplist is used.

iterate

Yes

No

Specifies a boolean value (true or false) that indicates whether this tag will operate as a body tag so that each row can be processed separately.

If the iterate attribute is set to true, the following value can be accessed from within the getGroupList tag:

  • groupid

This is the group name as referenced in EbiRealmGroup.

The variable groupid has a scope of NESTED.

If the iterate attribute is set to false, this tag will operate as a nonbody tag that returns an object of type List that contains a list of objects of type EbiGroupInfo.

Examples

This example shows how to use the getGroupList tag with the iterate attribute set to true:

  <%@ taglib uri="/fw" prefix="fw" %>
  <html>
  <head>
  </head>
  <body>
  <fw:login userid="admin" password="admin"/>
  <fw:getGroupList iterate="true">
  Group Name = <%=groupid%><br/>
  <p/>
  </fw:getGroupList>
  <fw:logoff />
  </body>
  </html>

This example shows how to use the getGroupList tag with the iterate attribute set to false:

  <%@ taglib uri="/fw" prefix="fw" %>
  <html>
  <head>
  </head>
  <body>
  <fw:login userid="admin" password="admin"/>
  <fw:getGroupList iterate="false"/>
  
  <%= ((java.util.List)pageContext.getAttribute("grouplist")).size() %> = the size of the list...
  <fw:logoff />
  </body>
  </html>

 
Top of page

getResource

Description

Retrieves resource set objects by string path. If the id attribute is not set, the resource will be assumed to be a string and returned inline. If the id attribute is set, the returned object will be returned via the variable named in the id attribute.

Syntax

  <prefix:getResource resourcePath="resourcePath" returnType="returnType"id="ID" />

Attribute

Required?

Request-time expression values supported?

Description

resourcePath

Yes

Yes

The path to a resource.

returnType

No

No

Specifies the data type for the requested resource. If the id attribute is set, the return type must be set to one of the following values:

  • document (when the return type is an org.w3c.dom.Document)

  • string (when the return type is String)

  • bytes (when the return type is byte[ ])

If the id attribute is not set, the resource will be assumed to be a string and returned inline.

id

No

No

Specifies the name of the variable that will be used to store the object.

If no value is specified, a default id of resource is used.

 
Top of page

getUserID

Description

Retrieves the user ID for the current user. If the current user is not logged in, the tag returns anonymous.

Wrapping   This tag wraps the getUserID() method on the EboDirectoryHelper class.

Syntax

  <prefix:getUserID id="ID" />

Attribute

Required?

Request-time expression values supported?

Description

id

No

No

Specifies the name of the variable that will be used to store the user ID.

If no value is specified, a default id of userid is used.

Example

  <% taglib uri="/fw" prefix="fw" %>
  ...
  <fw:getUserID id="user" />
  <%=pageContext.getAttribute("user")%>

 
Top of page

getUserInfo

Description

Retrieves information about a particular user. The object returned is of type EbiUserInfo. If you don't need the object, you can access some commonly used attributes directly from the page context.

Wrapping   This tag wraps the getUserInfoByUserID() method on the EbiUserDelegate interface.

Syntax

  <prefix:getUserID id="ID" userid="userid" />

Attribute

Required?

Request-time expression values supported?

Description

id

No

No

Specifies the name of the variable that will be used to store the user information object.

If no value is specified, a default ID of userinfo is used.

userid

Yes

No

Specifies the ID of a user.

userid

No

Yes

Gets the user ID from the context.

firstname

No

Yes

Gets the user firstname from the context (if not null).

lastname

No

Yes

Gets the user lastname from the context (if not null).

emailaddress

No

Yes

Gets the user emailaddress from the context (if not null).

Examples

This example shows how to get an attribute from the EbiUserInfo object:

  <% taglib uri="/fw" prefix="fw" %>
  ...
  <fw:getUserInfo userid="User1" />
  <%=pageContext.getAttribute("userinfo")%>
  Hello, <%= ((com.sssw.fw.usermgr.api.EbiUserInfo)pageContext.getAttribute("userinfo")).getUserFirstName() %>

This example shows how to access attributes from the context:

  <% taglib uri="/fw" prefix="fw" %>
  ...
  <fw:getUserInfo userid="User1" />
  <%=pageContext.getAttribute("userid") %>
  <%=pageContext.getAttribute("firstname") %>
  <%=pageContext.getAttribute("lastname") %>
  <%=pageContext.getAttribute("emailaddress") %>

 
Top of page

getUserList

Description

Returns a list of users for the framework. The objects returned are of type EbiUserInfo.

Wrapping   This tag wraps the getUsers() method on the EbiDirectoryDelegate interface.

Syntax

  <prefix:getUserList id="ID" iterate="iterate" />

Attribute

Required?

Request-time expression values supported?

Description

id

No

No

Specifies the name of the variable that will be used to store the list of users.

If no value is specified, a default id of userlist is used.

iterate

Yes

No

Specifies a boolean value (true or false) that indicates whether this tag will operate as a body tag so that each row can be processed separately.

If the iterate attribute is set to true, the following values can be accessed from within the getUserList tag:

  • userid

  • uuid

Each of these variables has a scope of NESTED.

If the iterate attribute is set to false, this tag will operate as a nonbody tag that returns an object of type List that contains a list of objects of type EbiUserInfo.

realmName

No

No

Specifies a directory realm.

If no value is specified, the default primary realm is used.

Examples

This example shows how to use the getUserList tag with the iterate attribute set to true:

  <%@ taglib uri="/fw" prefix="fw" %>
  <html>
  <head>
  </head>
  <body>
  <fw:login userid="admin" password="admin"/>
  <fw:getUserList iterate="true">
  UserID = <%=userid%><br/>
  UUID = <%=uuid%><br/>
  <p/>
  </fw:getUserList>
  <fw:logoff />
  </body>
  </html>

This example shows how to use the getUserList tag with the iterate attribute set to false:

  <%@ taglib uri="/fw" prefix="fw" %>
  <html>
  <head>
  </head>
  <body>
  <fw:login userid="admin" password="admin"/>
  <fw:getUserList iterate="false"/>
  
  <%= ((java.util.List)pageContext.getAttribute("userlist")).size() %> = the size of the list...
  <fw:logoff />
  </body>
  </html>

 
Top of page

getUserPreference

Description

Retrieves the user preference object for the ID passed in or the current user if no ID is provided. This tag is for getting and setting custom preferences. Preferences for portal objects should be done through the portal manager and the tags that support those functions such as getUserComponentInfoTag.

Wrapping   This tag wraps the getUserPreference() method on the EbiUserPreferenceDelegate interface.

Syntax

  <prefix:getUserProfile profilename="profilename" userid="userid"id="ID" />

Attribute

Required?

Request-time expression values supported?

Description

elementType

Yes

Yes

Specifies an element type.

elementID

Yes

Yes

Specifies an element ID.

id

No

No

Specifies the name of the variable that will be used to store the user preference object. This object is of type EbiUserPreferenceInfo.

If no value is specified, a default id of userPreference is used.

userIID

No

Yes

Specifies the UUID for a particular user.

 
Top of page

login

Description

Logs a user in to exteNd Director.

Wrapping   This tag wraps the authUserPassword() method on the EbiDirectoryDelegate interface.

Syntax

  <prefix:login userid="userid" password="password" id="ID" />

Attribute

Required?

Request-time expression values supported?

Description

userid

Yes

Yes

Specifies the ID for the user logging in.

password

Yes

Yes

Specifies the password for the user logging in.

id

No

No

Specifies the name of the variable that will be used to store the result of the operation. If the login attempt is successful, this variable holds a value of true. If the login attempt fails, this variable holds a value of false. A login may fail for the following reasons:

  • A user has already been logged in to the current session

  • The user ID is not recognized

  • The user ID/password combination is not valid

If no value is specified, a default id of success is used.

Example

  <% taglib uri="/fw" prefix="fw" %>
  ...
  <fw:login userid="admin" password="admin" id="result" />
  <%=pageContext.getAttribute("result")%> = the result of the login...

 
Top of page

logoff

Description

Logs off the current exteNd Director user.

Wrapping   This tag wraps the logoff() method on the EbiSession interface.

Syntax

  <prefix:logoff id="ID" />

Attribute

Required?

Request-time expression values supported?

Description

id

No

No

Specifies the name of the variable that will be used to store the result of the operation. If the logoff attempt is successful, this variable holds a value of true. If the logoff attempt fails, this variable holds a value of false.

If no value is specified, a default id of logoff is used.

Example

  <% taglib uri="/fw" prefix="fw" %>
  ...
  <fw:logoff id="result" />
  <%=pageContext.getAttribute("result")%> = the result of the logoff...

 
Top of page

removeGroup

Description

Deletes a group.

Wrapping   This tag wraps the removeGroup() method on the EbiDirectoryManager interface.

Syntax

  <prefix:removeGroup groupid="groupid" id="ID" />

Attribute

Required?

Request-time expression values supported?

Description

groupid

Yes

Yes

Specifies the ID of the group you want to delete.

id

No

No

Specifies the name of the variable that will be used to store the result of the operation. If the operation is successful, this variable holds a value of true. Otherwise, an exception is thrown.

If no value is specified, a default id of deletedgroup is used.

Example

This example shows how to use the removeGroup tag:

  <%@ taglib uri="/fw" prefix="fw" %>
  <html>
  <head>
  </head>
  <body>
  <fw:login userid="admin" password="admin"/>
  <fw:removeGroup groupid="Group1"/>
  <fw:logoff />
  </body>
  </html>

 
Top of page

removeUserFromGroup

Description

Removes a specified user from a group.

Wrapping   This tag wraps the removeMember() method on the EbiRealmGroupDelegate interface.

Syntax

  <prefix:removeUserFromGroup id="ID" userid="userid" groupid="groupid" />

Attribute

Required?

Request-time expression values supported?

Description

id

No

No

Specifies the name of the variable that will be used to store the result of the operation. If the operation is successful, this variable holds a value of true. If the operation fails, this variable holds a value of false.

If no value is specified, a default id of removeduserfromgroup is used.

userid

Yes

Yes

Specifies the ID for the user to remove.

groupid

Yes

Yes

Specifies the ID for the group from which the user will be removed.

Example

  <% taglib uri="/fw" prefix="fw" %>
  ...
  <fw:removeUserFromGroup id="result" userid="User1" groupid="Group1" />
  <%=pageContext.getAttribute("result")%>

 
Top of page

setUserPassword

Description

Changes the password for a specified user.

Wrapping   This tag wraps the modifyUser() method on the EbiUserDelegate interface.

Syntax

  <prefix:setUserPassword id="ID" userid="userid" passowrd="password" />

Attribute

Required?

Request-time expression values supported?

Description

id

No

No

Specifies the name of the variable that will be used to store the result of the operation. If the operation is successful, this variable holds a value of true. Otherwise, an exception is thrown.

If no value is specified, a default id of setpassword is used.

userid

Yes

Yes

Specifies the ID for the user whose password will be modified.

password

Yes

Yes

Specifies the new password.

Example

  <% taglib uri="/fw" prefix="fw" %>
  ...
  <fw:setUserPassword id="result" userid="User1" password="MyPassword" />
  <%=pageContext.getAttribute("result")%>

 
Top of page

userInGroup

Description

Determines whether a specified user is in a particular group.

Wrapping   This tag wraps the isMember() method on the EbiRealmGroupDelegate interface.

Syntax

  <prefix:userInGroup groupid="groupid" userid="userid" id="ID" />

Attribute

Required?

Request-time expression values supported?

Description

groupid

Yes

No

Specifies the ID of a group.

userid

Yes

No

Specifies the ID of a user.

id

No

No

Specifies the name of the variable that will be used to store the result of the operation. If the user is in the specified group, this variable holds a value of true. If the user is not in the group, this variable holds a value of false.

If no value is specified, a default id of useringroup is used.

Example

  <% taglib uri="/fw" prefix="fw" %>
  ...
  Is in group...
  <fw:userInGroup groupid="ContentAdmins" userid="JSmith" id="result" />
  <%=pageContext.getAttribute("result")%>

 
Top of page

userLoggedIn

Description

Determines whether the current user is logged in to the session.

Wrapping   This tag wraps the isAnonymous() method on the EboDirectoryHelper class.

Syntax

  <prefix:userLoggedIn id="ID" />

Attribute

Required?

Request-time expression values supported?

Description

id

No

No

Specifies the name of the variable that will be used to store the result of the operation. If the current user is already logged in, this variable holds a value of true. If the user has not yet logged in, this variable holds a value of false.

If no value is specified, a default id of loggedin is used.

Example

  <% taglib uri="/fw" prefix="fw" %>
  ...
  Is logged in...
  <fw:userLoggedIn />
  <%=pageContext.getAttribute("loggedin")%>


Copyright © 2004 Novell, Inc. All rights reserved. Copyright © 1997, 1998, 1999, 2000, 2001, 2002, 2003 SilverStream Software, LLC. All rights reserved.  more ...