Like what you see? Have a play with our trial version.

Error rendering macro 'rw-search'

null

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

User groups and roles can be created and modified with a web service call. The objects returned in the response is dependent on the type of call made in the request.

Note: If the Client Org functionality is turned on in the Configuration page, a Client Org can also be specified where applicable for certain types of calls.

This function returns all the user roles available in Yellowfin. The response contains an array of AdministrationRole objects displaying available roles.

 

  • Displayed below is a basic request for this function:

    AdministrationServiceRequest rsr = new AdministrationServiceRequest();
    
    rsr.setLoginId("admin@yellowfin.com.au");
    rsr.setPassword("test");
    rsr.setOrgId(1);
    
    rsr.setFunction("LISTROLES");



  • Once the request is configured, perform the call:

    AdministrationServiceResponse rs = adminService.remoteAdministrationCall(rsr);
    

    Initialize the Administration web service. Click here to learn how to do this. 

 

  • The response returned will contain these parameters:

    Response Element

    Data Type

    Description

    StatusCode

    String

    Status of the web service call. Possible values include:

    • SUCCESS
    • FAILURE

    Roles

    AdministrationRole[]

    List of roles

Complete Example

Below is a full example of the LISTROLES function. To use it for yourself, carry out the following the steps:

  1. Copy the code and save it as ws_listroles.jsp.
  2. Put the file in the root folder: Yellowfin/appserver/webapps/ROOT.
  3. Adjust the host, port, admin user details according to your environment.
  4. Run http://<host>:<port>/ws_listroles.jsp from your Internet browser.

 

<%            
/*              ws_listroles.jsp                 */
%>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ page import="com.hof.util.*, java.util.*, java.text.*" %> 
<%@ page import="com.hof.web.form.*" %>
<%@ page import="com.hof.mi.web.service.*" %>
<%
AdministrationServiceService s_adm = new AdministrationServiceServiceLocator("localhost",8080, "/services/AdministrationService", false);        // adjust host and port number
AdministrationServiceSoapBindingStub adminService = (AdministrationServiceSoapBindingStub) s_adm.getAdministrationService();
AdministrationServiceRequest rsr = new AdministrationServiceRequest();

rsr.setLoginId("admin@yellowfin.com.au");          // provide your Yellowfin webservices admin account
rsr.setPassword("test");                           // change to be the password of the account above
rsr.setOrgId(1);

rsr.setFunction("LISTROLES");

AdministrationServiceResponse rs = adminService.remoteAdministrationCall(rsr);

if ("SUCCESS".equals(rs.getStatusCode()) ) {
	out.write("Success.<br>Available Roles:");
	AdministrationRole[] roles = rs.getRoles();
	for (AdministrationRole role: roles){
		out.write("<br>");
		out.write("<br>Role Name: " + role.getRoleName());
		out.write("<br>Role Code: " + role.getRoleCode());
		out.write("<br>Role Description: " + role.getRoleDescription());
                                  
		// uncomment to display all the security functions:
		/*
		out.write("<br>Function Name | Code | Description | TypeCode | AccessLevelCode");
		for (AdministrationFunction f: role.getFunctions()){
			out.write("<br>" 	+ f.getFunctionName() + " | " 
								+ f.getFunctionCode() + " | " 
								+ f.getFunctionDescription() + " | " 
								+ f.getFunctionTypeCode() + " | " 
								+ f.getAccessLevelCode());
		}
		*/

	}
} else {
	out.write("Failure");
	out.write(" Code: " + rs.getErrorCode());
}
%>

 

 

This function creates a new role and/or updates the role functions. The request must contain an AdministrationRole object to specify the role details, and an array of AdministrationFunction for the role. Whether this function is used to update a role, or create a new one, it should be noted that every Yellowfin role requires a mandatory function, Report Access (function code: MIREPORT), MIREPORT access level code must be at least R (read). Each time this function is called, the security functions will be overwritten.

 

  • Displayed below is a basic request for this function:

    AdministrationServiceRequest rsr = new AdministrationServiceRequest();
    
    rsr.setLoginId("admin@yellowfin.com.au");
    rsr.setPassword("test");
    rsr.setOrgId(1);
    
    rsr.setFunction("SAVEROLE");



  • Then define a role:

    AdministrationRole role = new AdministrationRole();
    



  • Role Code is mandatory if you want to modify an existing role:

    role.setRoleCode("NEWROLE");			// If you want to create a new role, comment this out.

    If you do not specify the Role Code, the call will create a new role even if another role with the same name already exists.

     

    You can get the role codes from Yellowfin's database OrgRole table. (Usually, it is based on role name with all letters capitalized and with no space between them.)

     

     

  • Role Name is mandatory even when modifying an existing role, otherwise the call will set the role name to blank:

    role.setRoleName("New Role");
    role.setRoleDescription("testing");
    



  • Each time you call the SAVEROLE function, you need to provide a list of security functions. This call overwrites the role function. For instance, 2 functions will be assigned to the role: Report Access (mandatory) and Activity Stream (optional):

    AdministrationFunction[] f = new AdministrationFunction[1];
    f[0] = new AdministrationFunction();
    f[0].setFunctionCode("MIREPORT");
    f[0].setAccessLevelCode("R");
    f[1] = new AdministrationFunction();
    f[1].setFunctionCode("ACTIVITYSTREAM");
    f[1].setAccessLevelCode("CRUD");

    You cannot omit security functions; the call will generate an error otherwise. Click here for all available security function options.



  • Then feed the security functions to the role:

    role.setFunctions(f);
    rsr.setRole(role);
    



  • Once the request is configured, perform the call:

    AdministrationServiceResponse rs = adminService.remoteAdministrationCall(rsr);
    

    Initialize the Administration web service. Click here to learn how to do this. 

 

  • The response returned will contain these parameters:

    Response Element

    Data Type

    Description

    StatusCode

    String

    Status of the web service call. Possible values include:

    • SUCCESS
    • FAILURE

Complete Example

Below is a full example of the SAVEROLE function. To use it for yourself, carry out the following the steps:

  1. Copy the code and save it as ws_saverole.jsp.
  2. Put the file in the root folder: Yellowfin/appserver/webapps/ROOT.
  3. Adjust host, port, admin user details according to your environment.
  4. Run http://<host>:<port>/ws_saverole.jsp from your Internet browser.

 

<%            
/*              ws_saverole.jsp               */
%>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ page import="com.hof.util.*, java.util.*, java.text.*" %> 
<%@ page import="com.hof.web.form.*" %>
<%@ page import="com.hof.mi.web.service.*" %>
<% 
AdministrationServiceService s_adm = new AdministrationServiceServiceLocator("localhost",8080, "/services/AdministrationService", false);        // adjust host and port number
AdministrationServiceSoapBindingStub adminService = (AdministrationServiceSoapBindingStub) s_adm.getAdministrationService();
AdministrationServiceRequest rsr = new AdministrationServiceRequest();

rsr.setLoginId("admin@yellowfin.com.au");          // provide your Yellowfin web services admin account
rsr.setPassword("test");                           // change to the password of the account above
rsr.setOrgId(1);

rsr.setFunction("SAVEROLE");

//define a role:
AdministrationRole role = new AdministrationRole();
role.setRoleCode("NEWROLE");
role.setRoleName("New Role");
role.setRoleDescription("testing");

AdministrationFunction[] f = new AdministrationFunction[2];

f[0] = new AdministrationFunction();
f[0].setFunctionCode("MIREPORT");           // mandatory
f[0].setAccessLevelCode("R");

f[1] = new AdministrationFunction();
f[1].setFunctionCode("ACTIVITYSTREAM");               
f[1].setAccessLevelCode("CRUD");


//Feed the security functions to the role:
role.setFunctions(f);

rsr.setRole(role);
AdministrationServiceResponse rs = adminService.remoteAdministrationCall(rsr);


if ("SUCCESS".equals(rs.getStatusCode()) ) {
	out.write("Success");
} else {
	out.write("Failure");
	out.write(" Code: " + rs.getErrorCode());
}
%>


 

 

 

 

  • No labels