First Previous Next Last Core Development Guide  

CHAPTER 18    Framework Tag Library

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

For more information    For background information, see Using the Director Tag Libraries.

 
Top of page

addUserToGroup

Adds a specified user to a group.

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

Creates a new group.

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

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

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 email 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

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.

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 values 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.

Example 1

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>

Example 2

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

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 in-line. 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 if 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 in-line.

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

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

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

Retrieves information about a particular user. The object returned is of type EbiUserInfo.

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.

Example

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

 
Top of page

getUserList

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

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.

Example 1

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>

Example 2

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

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.

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

Logs a user in to Director.

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

Logs off the current Director user.

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

Deletes a group.

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 that 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

Removes a specified user from a group.

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 removeduserfromgroupd 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

Changes the password for a specified user.

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

Determines whether a specified user is in a particular group.

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 isingroup 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

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

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")%>
    First Previous Next Last Core Development Guide  

Copyright © 2000, 2001, 2002, 2003 SilverStream Software, LLC, a wholly owned subsidiary of Novell, Inc. All rights reserved.