Example name : CustomViewScopeExample.java
<Web NMS Home>/examples/Security/authorization directory
This example explains how to use the methods of CustomViewScopeAPI.
Custom View Scope is nothing but a collection of module
specific authorized views which belong to different
user/group, based on their security level. This example
performs the following tasks :
- Creates a custom view scope named "AlertCVS"
- Creates an authorized view named "MajorAlerts"
and with "severity" and "entity" as
- Assigns this authorized view "MajorAlerts"
to the group named "Users" and to the custom
view scope "AlertCVS"
- Creates a user named "testUser" and assigns
this user to the group "Users"
The interface used in this example is AuthorizationAdmin
Methods used in this example are :
public void createCVScope(java.lang.String cvscopeName)
This method creates a Custom View Scope with the given argument string as the Custom View Scope Name.
public void createAuthorizedView(java.util.Vector authViewObjVec)
This method creates a AuthorizedView and there by properties to be associated with the AuthorizedView are also set by passing the AuthorizedViewObject as a parameter.
public void setAuthorizedViewName(java.lang.String viewName)
This method sets the given argument string as the AuthorizedViewName that is to be associated with the
public void setViewProperties(java.util.Properties viewProp)
This method sets the AuthorizedView properties to be associated with the AuthorizedView. Here the argument viewProp which consists of Authorized properties can be stored as property name/property value pair.
Note : The source
code will have comment statements in it which will explain
to you the different segments of the program.
The steps given below will help you in integrating this example with Web NMS. If any of the steps given below are not followed properly, then the example might not function in a desired manner.
- Set the <Web NMS Home>/classes directory
- Compile the CustomViewScopeExample.java source file
[ javac -d <Web NMS Home>/classes CustomViewScopeExample.java]
- Ensure that the class file is placed in the <Web NMS Home>/classes
directory after compilation, in line with the package
name specified in the program
Now start the Web NMS Server and wait till it
successfully starts up
- Execute the program as given below :
On successful execution of the example program, the following messages are printed in the console :
- The CustomViewScope is created as AlertCVS
- The Authorized Scope is created as MajorAlerts with
criteria as severity, entity
- The Authorized Scope is assigned to group Users and
assigned to CustomViewScope AlertCVS
- The user is created with the name as testUser and
assigned to group Users.
Now the users belonging to the "Users" group
(i.e. user "testUser") will have the restriction
to view only Major alerts in the Alerts panel.
After you have tried this example, to remove its association with Web NMS, you must remove the class file
CustomViewScopeExample.class from <Web NMS
Copyright © 1996-2002, AdventNet Inc. All Rights Reserved.