User Management Actions
Import
//User Management imports
import com.intellica.client.security.SecurityManager;
import com.intellica.client.exception.ISecurityException;
import com.intellica.client.security.Authentication;
//Organization specific imports
import com.intellica.client.security.OrgInfo;
//User/Role specific imports
import com.intellica.client.security.RoleInfo;
import com.intellica.client.common.Enums.SecurityTypes.ReportPrivileges;
import com.intellica.client.common.Enums;
import java.util.Vector;
import java.util.HashMap;
Organization
This Java API is used to get an Organization for given Organization Id.
Refer to <Intellicus_Install_Path>/SampleCodes/Java APIs/Organization Management/ GetOrgById.java for sample code of this use case.
Steps :
- Initialize Report Client.
- Initialize Requestor UserInfo.
- Create a SecurityManager class object for getting the controller information for all Administration related operations.
SecurityManager sMgr=SecurityManager.getInstance();
- Get the Organization by OrgId and get its various details.
Method: getOrganizationById
public getOrganizationById(java.lang.String orgId, userInfo) throws
Method will return the organization Info for given orgId
Parameters:
- orgId: Id of the requested OrgInfo object
- userInfo: The current user details
Returns:
OrgInfo object having the given orgId (may return null)
//This will get the Information about any existing Organization
String organisationId=”Test”;
OrgInfo orgObj = sMgr.getOrganizationById( organisationId, requestorUserInfo);
System.out.println (“OrganizationName: “+orgObj.getOrgId());
System.out.println(“Description: “+orgObj.getOrgDescription());
System.out.println (“OrganizationMapType: “+orgObj.getMapType());
System.out.println(“Authorization mode: ” +orgObj.getAuthorizeMode());
System.out.println(“AuthenticationObject: “+orgObj.getAuthenticationObj());
This Java API is used to get list of users for the given organization in the Intellicus Repository. User is required to provide the organisation id, whose list of users, the requesting user wants to retrieve.
Refer to <Intellicus_Install_Path>/SampleCodes/Java APIs/Organization Management/GetUserListForOrg.java for sample code of this use case.
Steps:
- Initialize Report Client.
- Initialize Requestor UserInfo.
- Create a SecurityManager class object for getting the controller information for all Administration related operations.
SecurityManager sMgr = SecurityManager.getInstance();
- Get the Arraylist containing all users in the given Organization
Method: getUserListForOrganization
public java.util.ArrayList getUserListForOrganization(java.lang.String orgId,userInfo) throws
This method returns the list of users for the given Organization ID.
Parameters:
- OrgId: of the userInfo list to be retrieved.
Returns:
ArrayList of UserInfo Bean class
ArrayList arrList=new ArrayList();
String orgId=”Intellica”;
arrList = sMgr.getUserListForOrganization(orgId, requestorUserInfo);
This Java API is used to get the list of all organizations present in the Intellicus repository.
Refer to <Intellicus_Install_Path>/SampleCodes/Java APIs/Organization Management/ GetOrgList.java for sample code of this use case.
Steps:
- Initialize Report Client.
- Initialize Requestor UserInfo.
- Create a SecurityManager class object for getting the controller information for all Administration related operations.
SecurityManager sMgr=SecurityManager.getInstance();
- Get the Arraylist containing all users in the given Organization
Method: getOrgList
public java.util.ArrayList getOrgList( userInfo) throws
This method returns the list of all organizations created in Intellicus repository.
Returns:
ArrayList of OrgInfo objects.
//An arraylist created to hold the list of organizations in it.
ArrayList arrList=new ArrayList();
//Method returns list of all organizations in Intellicus repository
arrList=sMgr.getOrgList(requestorUserInfo);
This Java API is used to add a new organization in the Intellicus Repository and set the authentication mode.
Refer to <Intellicus_Install_Path>/SampleCodes/Java APIs/Organization Management/AddOrg.java for sample code of this use case.
Also, you may refer to AddCallbackOrg.java for creating an organization whose authentication check is performed by Callback Mechanism.
Steps:
- Initialize Report Client.
- Initialize Requestor UserInfo.
- Create instance of OrgInfo.
String organisationId=”Test”;
OrgInfo addOrg=new OrgInfo(organisationId);
- Set Authentication mode.
Method: setAuthenticateMode
public void setAuthenticateMode(int authenticateMode)
Authentication Mode Id values
1= Intellicus
(com.intellica.client.common.Enums.SecurityTypes.Authentication.REPORTINGSYS)
2= External Application
(com.intellica.client.common.Enums.SecurityTypes.Authentication.EXTERNALAPP)
3= Host Application
(com.intellica.client.common.Enums.SecurityTypes.Authentication.HOSTAPP)
4= Callback
(com.intellica.client.common.Enums.SecurityTypes.Authentication.CALLBACK)
This identifies who will authenticate the users/roles belonging to this organization.
Parameters:
authenticateMode – : Authentication Mode Id’s value
Authentication authInfo = new Authentication();
authInfo.setAuthenticateMode(com.intellica.client.common.Enums.SecurityTypes.Authentication.HOSTAPP);
addOrg.setAuthenticationObj(authInfo);
- Create a SecurityManager class object for getting the controller information for all Administration related operations.
SecurityManager sMgr=SecurityManager.getInstance();
- Add the Organization.
Method: addOrganization
public void addOrganization( orgInfo, userInfo) throws
This method adds a new Organization at the Report Engine.
Parameters:
- OrgInfo: The Organization details
- UserInfo: The User details
sMgr.addOrganization(addOrg, requestorUserInfo);
This Java API is used to modify the Organization’s details.
Refer to <Intellicus_Install_Path>/SampleCodes/Java APIs/Organization Management/ ModifyOrg.java for sample code of this use case.
Steps:
- Initialize Report Client.
- Initialize Requestor UserInfo.
- Get the Organization i.e. to be deleted By its Organization Id.
String organisationId=”Test”;
OrgInfo modOrg=sMgr.getOrganizationById( organisationId, requestorUserInfo);
- Set the attributes of Organization
modOrg.setCanDelete(true);
String description=”THIS IS A TEST ORGANIZATION”;
modOrg.setOrgDescription(description);
- Create a SecurityManager class object for getting the controller information for all Administration related operations.
SecurityManager sMgr=SecurityManager.getInstance();
- Modify the Organization.
Method: modifyOrganization
public void modifyOrganization(orgInfo, userInfo) throws
This method modifies an Organization at the Report Engine
Parameters:
- orgInfo: The Organization details
- userInfo: The current user
sMgr.modifyOrganization(modOrg,requestorUserInfo);
This Java API is used to delete an existing organization from the Intellicus repository.
Refer to <Intellicus_Install_Path>/SampleCodes/Java APIs/Organization Management/DeleteOrg.java for sample code of this use case.
Steps:
- Initialize Report Client.
- Initialize Requestor UserInfo.
- Get the Organization i.e. to be deleted By Organization Id.
String organizationId=”Test”;
OrgInfo delOrg = sMgr.getOrganizationById(organizationId, requestorUserInfo);
- Create a SecurityManager class object for getting the controller information for all Administration related operations.
SecurityManager sMgr=SecurityManager.getInstance();
- Delete the Organization.
Method: deleteOrganization
public void deleteOrganization( orgInfo, userInfo) throws
This method deletes an Organization at the Report Engine from the Intellicus Repository.
Parameters:
- orgInfo: The Organization details
- userInfo: The current user details
sMgr.deleteOrganization(delOrg,requestorUserInfo);
This Java API is used to assign the Access privileges of a Category to the specific Organization.
Refer to <Intellicus_Install_Path>/SampleCodes/Java APIs/User Management/ AssignCategoryPrivilegesToOrg.java for sample code of this use case.
Steps:
- Initialize Report Client.
- Initialize Requestor UserInfo.
- Create a SecurityManager class object for getting the controller information for all Administration related operations.
SecurityManager sMgr=SecurityManager.getInstance();
- Create instance of AppInfo that contains the Organization to which the access rights are to be assigned.
String userId=””;
String OrgId=”TestOrg”;
//AppType for which the privileges are to be set, “” for Org, “USER” for User and “ROLE” for Role
String appType = “”;
//Create instance of AppInfo that contains entity for which access rights are to be assigned
AppInfo appInfo = new AppInfo(userId,OrgId,appType);
- Create instance of EntityInfo which contains entity whose access rights are assigned on Category.
//Set desired entity : CATEGORY/REPORT/QO/PO/CUBEOBJECT /DASHBOARD2/DASHBOARD_WIDGET/DBCONNECTION
EntityInfo entityInfo=new EntityInfo(catId,”CATEGORY”);
- Create object of EntityAccessRight and set accessrights
EntityAccessRight ear=new EntityAccessRight();
ear.setAppInfo(appInfo);
/*access level can have below possible values-
FULLACCESS, PARTIALACCESS, DENYACCESS, NONEACCESS
* public void setAccessLevel(int accessLevel)
* @param accessLevel : access level can be 0/1/2/3
*/
ear.setAccessLevel(Enums.SecurityTypes.AccessLevel.PARTIALACCESS);
ear.setAccessRightGrants(“0,1,2”);
- Setting access rights for Reports, Dashboards under this category
//Access Rights for Reports under this category
EntityGroupAccessRight reportEAR=new EntityGroupAccessRight();
reportEAR.setType(“REPORT”);
reportEAR.setAccessLevel(1);//0 for deny, 1 for Full, 2 for Partial
reportEAR.setGrants(“10,12,14”);
ear.addEntityGroupAccessRight(reportEAR);
//Access Rights for Dashboards under this category
EntityGroupAccessRight dashboardEAR=new EntityGroupAccessRight();
dashboardEAR.setType(“DASHBOARD2”);
dashboardEAR.setAccessLevel(1);//0 for deny, 1 for Full, 2 for Partial
ear.addEntityGroupAccessRight(dashboardEAR);
ear.setOpCode(“REPLACE”);
Method:grantEntityPrivileges
This API allows the user to assign access rights information to a user/role/organization or Everyone on an entity.
Syntax
public void grantEntityPrivileges(EntityInfo entity,
EntityAccessRight entityAccessRight, UserInfo userInfo)throws ISecurityException.
Parameters:
- entity – The entity object.This object must be created by setting entityId and entityType. entityTypes supported are defined in EntityTypeNames class..
- entityAccessRight: The entityAccessRight object. This object should contain the AppInfo object with the credentials of the user to which grants are to be assigned and access level as defined in Enums.SecurityTypes.AccessLevel
- UserInfo: Details of current user who is providing access rights.
- Throws: ISecurityException: – If the request cannot be performed successfully. This happens – 1.if connection can’t be established with the engine or 2.if read or write operation cant be performed from or to the engine. 3.If some error has occured while executing the request on the engine. 4.If the response xml obtained from server cannot be parsed
Example:
Given below is the example of actual implementation of this method:
sMgr.grantEntityPrivileges(entityInfo, ear, requestorUserInfo);
This Java API is used to assign the Connection privileges to the specific Organization.
Refer to <Intellicus_Install_Path>/SampleCodes/Java APIs/User Management/ AssignConnectionPrivilegesToOrg.java for sample code of this use case.
Steps:
- Initialize Report Client.
- Initialize Requestor UserInfo.
- Create a SecurityManager class object for getting the controller information for all Administration related operations.
SecurityManager sMgr=SecurityManager.getInstance();
- Create instance of AppInfo that contains the UserId, Organization of the user to which the access rights are to be assigned.
String appId=””;
String OrgId=”TestOrg”;
//AppType for which the privileges are to be set, “” for Org, “USER” for User and “ROLE” for Role
String appType = “”;
//Create instance of AppInfo that contains entity for which access rights are to be assigned
AppInfo appInfo = new AppInfo(userId,OrgId,appType);
- Create instance of EntityInfo which contains entity whose access rights are assigned on Category.
// Connection whose privileges are to be set for the specified Organization
String entityId=”DemoReportDB”;//Category Id on which AccessRights will be given to the user;
//Set desired entity : CATEGORY/REPORT/QO/PO/CUBEOBJECT/DASHBOARD2/DASHBOARD_WIDGET/DBCONNECTION
EntityInfo entityInfo=new EntityInfo(entityId,”DBCONNECTION”);
- Create object of EntityAccessRight and set accessrights
EntityAccessRight ear=new EntityAccessRight();
ear.setAppInfo(appInfo);
/*access level can have below values possible.
* Full Access
* Deny Access
**/
ear.setAccessLevel(Enums.SecurityTypes.AccessLevel.FULLACCESS);
ear.setOpCode(“REPLACE”);
Method: grantEntityPrivileges
This API allows the user to assign access rights information to a user/role/organization or Everyone on an entity.
Syntax
public void grantEntityPrivileges(EntityInfo entity,
EntityAccessRight entityAccessRight, UserInfo userInfo) throws ISecurityException.
Parameters:
- entity – The entity object.This object must be created by setting entityId and entityType. entityTypes supported are defined in EntityTypeNames class..
- entityAccessRight: The entityAccessRight object. This object should contain the AppInfo object with the credentials of the user to which grants are to be assigned and access level as defined in Enums.SecurityTypes.AccessLevel
- UserInfo: Details of current user who is providing access rights.
- Throws: ISecurityException: – If the request cannot be performed successfully. This happens – 1.if connection can’t be established with the engine or 2.if read or write operation cant be performed from or to the engine. 3.If some error has occured while executing the request on the engine. 4.If the response xml obtained from server cannot be parsed
Example:
Given below is the example of actual implementation of this method:
sMgr.grantEntityPrivileges(entityInfo, ear, requestorUserInfo);
User
This Java API is used to get User’s information for the given userid.
Refer to <Intellicus_Install_Path>/SampleCodes/Java APIs/User Management/GetUserById.java for sample code of this use case.
Steps:
- Initialize Report Client.
- Initialize Requestor UserInfo.
- Create a SecurityManager class object for getting the controller information for all Administration related operations.
SecurityManager sMgr=SecurityManager.getInstance();
- Get the User by User Id.
Method: getUserById
Public getUserById(java.lang.String userId, java.lang.String orgId, userInfo) throws
This method returns the UserInfo class object having the given userId of the given orgId
Parameters:
- userId: Id of the requested UserInfo object.
- orgId: Organization Id of the requested user.
- userInfo: The current user details.
Returns:
UserInfo: object having the given userId (may return null)
String userId = “Mary”;
String orgId = “MyOrg”;
UserInfo userInfo=sMgr.getUserById(userId, orgId , requestorUserInfo);
This Java API is used to create a new User in Intellicus Repository.
Refer to <Intellicus_Install_Path>/SampleCodes/Java APIs/User Management/ AddUser.java for sample code of this use case.
Steps:
- Initialize Report Client.
- Initialize Requestor UserInfo.
- Create a SecurityManager class object for getting the controller information for all Administration related operations.
SecurityManager sMgr=SecurityManager.getInstance();
- Create instance of new User and set its attributes.
String username = “Mary”;
String password = “123456”;
String orgId = “Org1”;
UserInfo addUserInfo = new UserInfo(username, password, orgId);
// Optionally, make the user admin for that organization.
addUserInfo.setAdmin(true);
// Optionally, make the user Super admin.
addUserInfo.setSuperAdmin(true);
- Add the User in Intellicus Repository.
Method: addUser
public void addUser(newUserInfo, userInfo) throws
Adds a new User at the Report Engine.
Parameters:
- newUserInfo: The new user or target user details.
- userInfo: The current user details
sMgr.addUser(addUserInfo,requestorUserInfo);
This Java API is used to assign the Access privileges of a Category to the specific Organization.
Refer to <Intellicus_Install_Path>/SampleCodes/Java APIs/User Management/ AssignCategoryPrivilegesToOrg.java for sample code of this use case.
Steps:
- Initialize Report Client.
- Initialize Requestor UserInfo.
- Create a SecurityManager class object for getting the controller information for all Administration related operations.
SecurityManager sMgr=SecurityManager.getInstance();
- Create instance of AppInfo that contains the UserId, Organization of the user to which the access rights are to be assigned.
Also set AppType=”USER”
String userId=”Mary”;
String OrgId=”TestOrg”;
//AppType for which the privileges are to be set, “” for Org, “USER” for User and “ROLE” for Role
String appType = “USER“;
//Create instance of AppInfo that contains entity for which access rights are to be assigned
AppInfo appInfo = new AppInfo(userId,OrgId,appType);
- Create instance of EntityInfo which contains entity whose access rights are assigned on Category.
//Set desired entity : CATEGORY/REPORT/QO/PO/CUBEOBJECT
/DASHBOARD2/DASHBOARD_WIDGET/DBCONNECTION
EntityInfo entityInfo=new EntityInfo(catId,”CATEGORY”);
- Create object of EntityAccessRight and set accessrights
EntityAccessRight ear=new EntityAccessRight();
ear.setAppInfo(appInfo);
/*access level can have below possible values-
FULLACCESS, PARTIALACCESS, DENYACCESS, NONEACCESS
* public void setAccessLevel(int accessLevel)
* @param accessLevel : access level can be 0/1/2/3
*/
ear.setAccessLevel(Enums.SecurityTypes.AccessLevel.PARTIALACCESS);
ear.setAccessRightGrants(“0,1,2”);
- Setting access rights for Reports under this category
//Access Rights for Reports under this category
EntityGroupAccessRight reportEAR=new EntityGroupAccessRight();
reportEAR.setType(“REPORT”);
reportEAR.setAccessLevel(1);//0 for deny, 1 for Full, 2 for Partial
reportEAR.setGrants(“10,12,14”);
ear.addEntityGroupAccessRight(reportEAR);
ear.setOpCode(“REPLACE”);
Method: grantEntityPrivileges
This API allows the user to assign access rights information to a user/role/organization or Everyone on an entity.
Syntax
public void grantEntityPrivileges(EntityInfo entity,
EntityAccessRight entityAccessRight, UserInfo userInfo)throws ISecurityException.
Parameters:
- entity – The entity object.This object must be created by setting entityId and entityType. entityTypes supported are defined in EntityTypeNames class..
- entityAccessRight: The entityAccessRight object. This object should contain the AppInfo object with the credentials of the user to which grants are to be assigned and access level as defined in Enums.SecurityTypes.AccessLevel
- UserInfo: Details of current user who is providing access rights.
- Throws: ISecurityException: – If the request cannot be performed successfully. This happens – 1.if connection can’t be established with the engine or 2.if read or write operation cant be performed from or to the engine. 3.If some error has occured while executing the request on the engine. 4.If the response xml obtained from server cannot be parsed
Example:
Given below is the example of actual implementation of this method:
sMgr.grantEntityPrivileges(entityInfo, ear, requestorUserInfo);
This Java API is used to set the Report Access Privileges for a particular user. The user would require to provide its identity i.e. user Info and the Report for which the access rights are to be given.
Refer to <Intellicus_Install_Path>/SampleCodes/Java APIs/User Management/ AssignReportPrivilegesToUser.java for sample code of this use case.
Steps:
- Initialize Report Client.
- Initialize Requestor UserInfo.
- Create a SecurityManager class object for getting the controller information for all Administration related operations.
SecurityManager sMgr=SecurityManager.getInstance();
- Create instance of AppInfo that contains the UserId, Organization of the user to which the access rights on report are to be assigned.
Also set AppType=”USER”
//Set appId = <ROLE_NAME> and appType=”ROLE”
String appId=”Mary”;
String OrgId=”TestOrg”;
//AppType for which the privileges are to be set, “” for Org, “USER” for User and “ROLE” for Role
String appType = “USER“;
//Create instance of AppInfo that contains entity for which access rights are to be assigned
AppInfo appInfo = new AppInfo(appId,OrgId,appType);
- Create instance of EntityInfo which contains entityID/ReportID for which access rights are to be assigned
String reportId=”D07131A2-87AA-154E-6E17-6079C9AFD176″;
//Set desired entity : CATEGORY/REPORT/QO/PO/CUBEOBJECT
//DASHBOARD2/DASHBOARD_WIDGET/DBCONNECTIONEntityInfo entityInfo=new EntityInfo(reportId,”REPORT”);
- Create object of EntityAccessRight and set accessrights
EntityAccessRight ear=new EntityAccessRight();
ear.setAppInfo(appInfo);
/*access level can have below possible values-
FULLACCESS, PARTIALACCESS, DENYACCESS, NONEACCESS
* public void setAccessLevel(int accessLevel)
* @param accessLevel : access level can be 0/1/2/3*/
ear.setAccessLevel(Enums.SecurityTypes.AccessLevel.PARTIALACCESS);
ear.setAccessRightGrants(“0,2,4,6,7,8,12”);
ear.setOpCode(“REPLACE”);
Method:grantEntityPrivileges
This API allows the user to assign access rights information to a user/role/organization or Everyone on an entity.
Syntax:
public void grantEntityPrivileges(EntityInfo entity,
EntityAccessRight entityAccessRight, UserInfo userInfo)throws ISecurityException.
Parameters:
- entity – The entity object.This object must be created by setting entityId and entityType. entityTypes supported are defined in EntityTypeNames class..
- entityAccessRight: The entityAccessRight object. This object should contain the AppInfo object with the credentials of the user to which grants are to be assigned and access level as defined in Enums.SecurityTypes.AccessLevel
- UserInfo: Details of current user who is providing access rights.
- Throws: ISecurityException: – If the request cannot be performed successfully. This happens – 1.if connection can’t be established with the engine or 2.if read or write operation cant be performed from or to the engine. 3.If some error has occured while executing the request on the engine. 4.If the response xml obtained from server cannot be parsed
Example:
Given below is the example of actual implementation of this method:
sMgr.grantEntityPrivileges(entityInfo, ear, requestorUserInfo);
This Java API is used to assign the Entity privileges to the specific User.
Refer to <Intellicus_Install_Path>/SampleCodes/Java APIs/User Management/ AssignEntityPrivilegesToUser.java for sample code of this use case.
Steps:
- Initialize Report Client.
- Initialize Requestor UserInfo.
- Create a SecurityManager class object for getting the controller information for all Administration related operations.
SecurityManager sMgr=SecurityManager.getInstance();
- Create instance of AppInfo that contains the UserId, Organization of the user to which the access rights are to be assigned.
Also set AppType=”USER”
String userId=”Mary”;
String OrgId=”TestOrg”;
//AppType for which the privileges are to be set, “” for Org, “USER” for User and “ROLE” for Role
String appType = “USER“;
//Create instance of AppInfo that contains entity for which access rights are to be assigned
AppInfo appInfo = new AppInfo(userId,OrgId,appType);
- Create instance of EntityInfo which contains entity whose access rights are assigned on Category.
// Query ID whose System Privileges are to be set for the specified user.
String entityID=”SalesQuery”;
//Set desired entity : CATEGORY/REPORT/QO/PO/CUBEOBJECT //DASHBOARD2/DASHBOARD_WIDGET/DBCONNECTION
EntityInfo entityInfo=new EntityInfo(entityID,”QO”);
- Create object of EntityAccessRight and set accessrights
EntityAccessRight ear=new EntityAccessRight();
ear.setAppInfo(appInfo);
/*access level can have below possible values-
FULLACCESS, PARTIALACCESS, DENYACCESS, NONEACCESS
* public void setAccessLevel(int accessLevel)
* @param accessLevel : access level can be 0/1/2/3
*/
ear.setAccessLevel(Enums.SecurityTypes.AccessLevel.PARTIALACCESS);
ear.setAccessRightGrants(“0,2”);
Method: grantEntityPrivileges
This API allows the user to assign access rights information to a user/role/organization or Everyone on an entity.
Syntax:
public void grantEntityPrivileges(EntityInfo entity,
EntityAccessRight entityAccessRight, UserInfo userInfo)throws ISecurityException.
Parameters:
- entity – The entity object.This object must be created by setting entityId and entityType. entityTypes supported are defined in EntityTypeNames class..
- entityAccessRight: The entityAccessRight object. This object should contain the AppInfo object with the credentials of the user to which grants are to be assigned and access level as defined in Enums.SecurityTypes.AccessLevel
- UserInfo: Details of current user who is providing access rights.
- Throws: ISecurityException: – If the request cannot be performed successfully. This happens – 1.if connection can’t be established with the engine or 2.if read or write operation cant be performed from or to the engine. 3.If some error has occured while executing the request on the engine. 4.If the response xml obtained from server cannot be parsed
Example:
Given below is the example of actual implementation of this method:
sMgr.grantEntityPrivileges(entityInfo, ear, requestorUserInfo);
This Java API is used to assign the System Privileges to the User. The user would require to provide its identity i.e. user Info as well as of the user who is providing System Privileges.
Refer to <Intellicus_Install_Path>/SampleCodes/Java APIs/User Management/ AssignSystemPrivilegesToUser.java for sample code of this use case.
Steps:
- Initialize Report Client.
- Initialize Requestor UserInfo.
- Create a SecurityManager class object for getting the controller information for all Administration related operations.
SecurityManager sMgr=SecurityManager.getInstance();
- Create instance of User for which System Privileges are to be set.
String userId=”FinanceUser”;
String organization==”MyOrg”;
UserInfo userInfo = sMgr.getUserById(userId, organization, requestorUserInfo);
- Assign System Privileges to assigneeUser.
Method : setSystemPrivileges
public void setSystemPrivileges(java.lang.String systemPrivileges)
Enums.SecurityTypes.SystemPrivileges.CATEGORY_SETUP
Enums.SecurityTypes.SystemPrivileges.DATA_ADMIN
Enums.SecurityTypes.SystemPrivileges.IM_SUPPORT
Enums.SecurityTypes.SystemPrivileges.systemPrevilegesMap
Enums.SecurityTypes.SystemPrivileges.SCHEDULER
Enums.SecurityTypes.SystemPrivileges.REPORT_DESIGNER
Enums.SecurityTypes.SystemPrivileges.DEPLOYREPORTBUNDLE
Enums.SecurityTypes.SystemPrivileges.CATEGORY_SETUP_GLOBAL
Enums.SecurityTypes.SystemPrivileges.SCHEDULER_GLOBAL
Enums.SecurityTypes.SystemPrivileges.DATA_ADMIN_GLOBAL
Enums.SecurityTypes.SystemPrivileges.ADHOCREPORTDESIGNER
Enums.SecurityTypes.SystemPrivileges.WIDGET_DESIGNER
Enums.SecurityTypes.SystemPrivileges.GENERATE_LINK Enums.SecurityTypes.SystemPrivileges. GENERATE_LINK_GLOBAL
This method sets System Privileges in the comma-separated format.
userInfo.setSystemPrivileges(new com.intellica.client.utils.Utility().getRightsFromMaskedValue(
com.intellica.client.common.Enums.SecurityTypes.SystemPrivileges.CATEGORY_SETUP | com.intellica.client.common.Enums.SecurityTypes.SystemPrivileges.SCHEDULER | com.intellica.client.common.Enums.SecurityTypes.SystemPrivileges.SCHEDULER_GLOBAL |
com.intellica.client.common.Enums.SecurityTypes.SystemPrivileges.WIDGET_DESIGNER |
com.intellica.client.common.Enums.SecurityTypes.SystemPrivileges.REPORT_DESIGNER |
com.intellica.client.common.Enums.SecurityTypes.SystemPrivileges.ADHOCREPORTDESIGNER |
Enums.SecurityTypes.SystemPrivileges.GENERATE_LINK));
sMgr.modifyUser(userInfo,requestorUserInfo);
This Java API is used to assign a specified existing role to the application user.
Refer to <Intellicus_Install_Path>/SampleCodes/Java APIs/User Management/ AssignRoleToUser.java for sample code of this use case.
Steps:
- Initialize Report Client.
- Initialize Requestor UserInfo.
- Create a SecurityManager class object for getting the controller information for all Administration related operations.
SecurityManager sMgr=SecurityManager.getInstance();
- Create instance of User for which System Privileges are to be set.
String userId =”User1″; // Id of the application user
String orgId =”MyOrg”;
UserInfo userInfo = sMgr.getUserById(userId, orgId ,requestorUserInfo);
- Create instance of RoleInfo that is to be assigned to the User.
String roleId =”Manager”; // Id of the role to be Assigned
RoleInfo roleInfo = sMgr.getRoleById(roleId, orgId ,requestorUserInfo);
- Grant this Role Info to the assignee User.
Method: grantRoleToUser
public void grantRoleToUser(targetUInfo,rInfo, userInfo) throws
This method grants new role to User and keeps previous roles of that user in-tact.
Parameters:
- TargetUInfo: intellica.client.common.UserInfo class object to which roles has to be assigned.
- RInfo: intellica.client.security.RoleInfo object to be granted.
- UserInfo: The details of the requesting user.
sMgr.grantRoleToUser(userInfo,roleInfo,requestorUserInfo);
Assign Roles To User
This Java API is used to assign multiple roles to the application user.
Refer to <Intellicus_Install_Path>/SampleCodes/Java APIs/User Management/ AssignRolesToUser.java for sample code of this use case.
Steps:
- Initialize Report Client.
- Initialize Requestor UserInfo.
- Create a SecurityManager class object for getting the controller information for all Administration related operations.
SecurityManager sMgr=SecurityManager.getInstance();
- Create instance of User for which System Privileges are to be set.
String userId=”TestUser”;// Id of the application user
String orgId=”MyOrg”;
UserInfo userInfo=sMgr.getUserById(userId, orgId ,requestorUserInfo);
- Create instance of RoleInfo that is to be assigned to the User.
String roleId1 = “Manager”;//Id of the role1 to be Assigned
String roleId2 = “Administrator”;//Id of the role2 to be assigned
RoleInfo roleInfo1 = sMgr.getRoleById(roleId1, orgId ,requestorUserInfo);
RoleInfo roleInfo2 = sMgr.getRoleById(roleId2, orgId ,requestorUserInfo);
- Grant these Roles to the assignee User.
Method: assignRolesToUser
public void assignRolesToUser( targetUInfo, java.util.ArrayList roleInfos, userInfo) throws
This method attaches a User with more than one role.
Parameters:
- targetUInfo: The user to be attached with a role.
- roleInfos: Array List of Roles to be attached with user.
- userInfo: The details of the current user.
ArrayList roleInfoArr = new ArrayList();
roleInfoArr.add(roleInfo1);//Add roleInfo object role1 to Array
roleInfoArr.add(roleInfo2);//Add roleInfo object “role2” to Array
sMgr.assignRolesToUser(userInfo,roleInfoArr,requestorUserInfo);
This Java API is to revoke specified role from user
Refer to <Intellicus_Install_Path>/SampleCodes/Java APIs/User Management/ RevokeRoleFromUser.java for sample code of this use case.
Steps:
- Initialize Report Client.
- Initialize Requestor UserInfo.
- Create a SecurityManager class object for getting the controller information for all Administration related operations.
SecurityManager sMgr=SecurityManager.getInstance();
- Get User by User Id whose role is to be revoked.
String userId = “User1”; // Id of the application User
String orgId= “MyOrg”;
UserInfo userInfo=sMgr.getUserById(userId, orgId ,requestorUserInfo);
- Create instance of RoleInfo that is to be revoked for the given User.
String roleId = “Manager”; // Id of the role to be Assigned
RoleInfo roleInfo=sMgr.getRoleById(roleId, orgId ,requestorUserInfo);
- Revoke the Role from assignee User.
Method: revokeRoleFromUser
public void revokeRoleFromUser(UserInfo targetUInfo, RoleInfo rInfo, UserInfo userInfo)
throws ISecurityException
This method revokes or removes role assigned previously to the user.
Parameters:
- TargetUInfo: intellica.client.common.UserInfo class object to which role has to be revoked.
- rInfo: com.intellica.client.security.RoleInfo object to be revoked from the user.
- userInfo: The details of the current User.
sMgr.revokeRoleFromUser(userInfo,roleInfo,requestorUserInfo);
This Java API is used to map the host application user with Intellicus user in the Intellicus Repository.
Refer to <Intellicus_Install_Path>/SampleCodes/Java APIs/User Management/UserMapping.java for sample code of this use case.
Steps:
- Initialize Report Client.
- Initialize Requestor UserInfo.
- Create a SecurityManager class object for getting the controller information for all Administration related operations.
SecurityManager sMgr=SecurityManager.getInstance();
- Get User by User Id to which , new user is to be mapped
String userId=”Smith”;// Id of the application user
String password=””;
String orgId=”MyOrg”;
UserInfo userInfo = new UserInfo(userId, password , orgId);
- Map the new User implementing mapAppIdToUser method.
String newUserId=”John”;
sMgr.mapAppIdToUser(newUserId,userInfo, requestorUserInfo);
Details of Method: mapAppIdToUser
public void mapAppIdToUser(java.lang.String appId, UserInfo targetUInfo, UserInfo userInfo)
throws ISecurityException
This method adds a mapping between an AppId and the user.
Parameters:
- AppId: is the application Id.
- TargetUInfo: is the targeted User.
- UserInfo: the current user details.
This Java API is used to delete an existing user with given userId from the Intellicus Repository.
Refer to <Intellicus_Install_Path>/SampleCodes/Java APIs/User Management/ DeleteUser.java for sample code of this use case.
Steps:
- Initialize Report Client.
- Initialize Requestor UserInfo.
- Create a SecurityManager class object for getting the controller information for all Administration related operations.
SecurityManager sMgr=SecurityManager.getInstance();
- Get UserInfo instance of the user that is to be deleted.
String userId=”FinanaceUser”;
String orgId=”FinanceOrg”;//Organization Id in which user exists.
UserInfo targetUserInfo=sMgr.getUserById(userId,orgId, requestorUserInfo);
- Delete the User.
Method: deleteUser
public void deleteUser(UserInfo targetUInfo, UserInfo userInfo) throws ISecurityException
This method deletes an existing User’s Info at the Report Engine.
Parameters:
- TargetUInfo: The UserInfo object of the user to be deleted.
- UserInfo: The details of the current user.
sMgr.deleteUser(targetUserInfo,requestorUserInfo);
Role
This Java API is used to get the list of all Roles present in Intellicus Repository.
Refer to <Intellicus_Install_Path>/SampleCodes/Java APIs/Role Management/ GetRoleList.java for sample code of this use case.
Steps:
- Initialize Report Client.
- Initialize Requestor UserInfo.
- Create a SecurityManager class object for getting the controller information for all Administration related operations.
SecurityManager sMgr=SecurityManager.getInstance();
- Get the role list.
Method: getRoleList
public java.util.ArrayList getRoleList(UserInfo userInfo) throws ISecurityException
This method returns the list of all roles created in Intellicus repository.
Returns:
ArrayList of roleInfo Bean class RoleInfo
roleList=sMgr.getRoleList(requestorUserInfo);
This Java API is used to add a new role in the existing Organization.
Refer to <Intellicus_Install_Path>/SampleCodes/Java APIs/Role Management/ AddRole.java for sample code of this use case.
Steps:
- Initialize Report Client.
- Initialize Requestor UserInfo.
- Create a SecurityManager class object for getting the controller information for all Administration related operations.
SecurityManager sMgr=SecurityManager.getInstance();
- Create instance of RoleInfo for the role to be added in the Organization.
String roleName = “MANAGER”;
String orgId = “Org1”;
RoleInfo newRole = new RoleInfo(roleName, orgId );
- Add the role in the organization.
Method : addRole
public void addRole(RoleInfo roleInfo, UserInfo userInfo) throws ISecurityException
This method adds a new Role at the Report Engine.
Parameters:
- roleInfo: The details of new Role.
- userInfo: The current user.
sMgr.addRole(newRole,requestoruserInfo);
This Java API is used to assign the Access privileges of a Category to the existing Role.
Refer to <Intellicus_Install_Path>/SampleCodes/Java APIs/Role Management/ AssignCategoryPrivilegesToRole.java for sample code of this use case.
Steps:
- Initialize Report Client.
- Initialize Requestor UserInfo.
- Create a SecurityManager class object for getting the controller information for all Administration related operations.
SecurityManager sMgr=SecurityManager.getInstance();
- Create EntityInfo and AppInfo
//RoleID of the Role for which AccessRights are to be assigned
String roleId = “Manager”;//role Id to be checked whether exists or not in the Intellicus server
String orgId = “hostOrg”;
String categoryId = “B2996F87-FE41-8D19-6C67-B3C22803DD99″;
EntityInfo entityInfo = new EntityInfo(categoryId,”CATEGORY”);
AppInfo appInfo = new AppInfo(roleId,orgId,”ROLE”);
- Create EntityAccessRight Object and set this AppInfo and EntityInfo in its object.
EntityAccessRight ear=new EntityAccessRight();
/*public void setAppInfo(AppInfo appInfo)Parameters:
*appInfo – : AppInfo object.
* */
ear.setAppInfo(appInfo);
/*access level can have three values possible.
* Deny Access = 0
* Full Access = 1
* Partial Access = 2
* None Access = 3*/
/**
* public void setAccessLevel(int accessLevel)
* @param accessLevel : access level can be 0/1/2
*/
ear.setAccessLevel(Enums.SecurityTypes.AccessLevel.FULLACCESS);
- Assign Category Privileges to assigneeUser using assignCategoryPrivilegesToUser.
Method: grantEntityPrivileges
Syntax
public void grantEntityPrivileges(EntityInfo entity,
EntityAccessRight entityAccessRight, UserInfo userInfo)
API allows the user to assign access rights information to a user/role/organization or Everyone on an entity.
Parameters:
- entity: The entity object.This object must be created by setting entityId and entityType. entityTypes supported are defined in EntityTypeNames class.
- entityAccessRight: The entityAccessRight object. This object should contain the AppInfo object with the credentials of the user to which grants are to be assigned and access level as defined in Enums.SecurityTypes.AccessLevel
- userInfo: Details of current user who is providing access rights.
Example:
Given below is the example of actual implementation of this method:
sMgr.grantEntityPrivileges(entityInfo, ear, adminUserInfo);
This Java API is used to assign the Access privileges for a Report to the Role.
Refer to <Intellicus_Install_Path>/SampleCodes/Java APIs/Role Management/ AssignReportPrivilegesToRole.java for sample code of this use case.
Steps:
- Initialize Report Client.
- Initialize Requestor UserInfo.
- Create a SecurityManager class object for getting the controller information for all Administration related operations.
SecurityManager sMgr=SecurityManager.getInstance();
- Create EntityInfo and AppInfo
//RoleID of the Role for which AccessRights are to be assigned
String roleId=”Manager”;
String organisationId=”Intellica”;
String reportId=”638CB7A6-F504-0ECD-008F-10B25253DCA8″;
EntityInfo entityInfo=new EntityInfo(reportId,”REPORT”);
AppInfo appInfo = new AppInfo(roleId,organisationId,”ROLE”);
- Create EntityAccessRight Object and set this AppInfo and EntityInfo in its object.
EntityAccessRight ear=new EntityAccessRight();
/*public void setAppInfo(AppInfo appInfo)Parameters:
*appInfo – : AppInfo object.
* */
ear.setAppInfo(appInfo);
/*access level can have three values possible.
* Deny Access = 0
* Full Access = 1
* Partial Access = 2
* None Access = 3*/
/**
* public void setAccessLevel(int accessLevel)
* @param accessLevel : access level can be 0/1/2
*/
ear.setAccessLevel(Enums.SecurityTypes.AccessLevel.FULLACCESS);
- Assign Category Privileges to assigneeUser using assignCategoryPrivilegesToUser.
Method: grantEntityPrivileges
Syntax:
public void grantEntityPrivileges(EntityInfo entity, EntityAccessRight entityAccessRight,
UserInfo userInfo)
API allows the user to assign access rights information to a user/role/organization or Everyone on an entity.
Parameters:
- entity: The entity object.This object must be created by setting entityId and entityType. entityTypes supported are defined in EntityTypeNames class.
- entityAccessRight: The entityAccessRight object. This object should contain the AppInfo object with the credentials of the user to which grants are to be assigned and access level as defined in Enums.SecurityTypes.AccessLevel
- userInfo: Details of current user who is providing access rights.
Example:
Given below is the example of actual implementation of this method:
sMgr.grantEntityPrivileges(entityInfo, ear, adminUserInfo);
This Java API is used to delete a particular Role of an existing Organization in Intellicus Repository.
Refer to <Intellicus_Install_Path>/SampleCodes/Java APIs/Role Management/ DeleteRole.java for sample code of this use case.
Steps:
- Initialize Report Client.
- Initialize Requestor UserInfo.
- Create a SecurityManager class object for getting the controller information for all Administration related operations.
SecurityManager sMgr=SecurityManager.getInstance();
- Create instance of RoleInfo for the role which is to be deleted from the Organization.
//Role ID i.e. to be deleted
String roleId = “Manager”;// Id of the role to be deleted
//Organization from which the given role is to be deleted.
String orgId = “Test”;
RoleInfo roleInfo = new RoleInfo(roleId,orgId);
- Assign the Report Privileges to the Role for given Report Id in a particular Category.
Method: deleteRole
public void deleteRole(RoleInfo roleInfo, UserInfo userInfo) throws ISecurityException
This method deletes a Role at the Report Engine.
Parameters:
- RoleInfo: The role to be deleted.
- userInfo: The current user details.
sMgr.deleteRole(roleInfo,requestorUserInfo