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

Error rendering macro 'rw-search'

null

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Expand
titleADDUSER

This function creates a new user account in Yellowfin.

 

  • Here's a basic request to create a new Yellowfin user:

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

 

  • If you need to create a new user in a specific client organization, add this to your code

    Code Block
    languagejava
    rsr.setOrgRef("org1");      // A new user will be added to the client with "org1" as an organization reference ID


    If you do not define the orgRef parameter, the new user will be created in the default (primary) organization.

 

  • The ADDUSER function requires AdministrationPerson object where you define the new Yellowfin user details:

    Code Block
    languagejava
    AdministrationPerson ap = new AdministrationPerson();
    
  • To create a new user, you need to fill these mandatory parameters: UserId, FirstName, LastName, RoleCode, Password, EmailAddress:

    Code Block
    languagejava
    ap.setUserId("john.smith@yellowfin.com.au");  // if Yellowfin authentication option is set "email address"
    ap.setFirstName("John");
    ap.setLastName("Smith");
    ap.setRoleCode("YFREPORTCONSUMER");                // Yellowfin role codes can be found performing this query against 
    												   // Yellowfin configuration database: SELECT * FROM OrgRole
    
    ap.setPassword("test");                    		   // Password must comply with your Yellowfin password policy
    ap.setEmailAddress("john.smith@yellowfin.com.au");

    Other parameters of AdministrationPerson object are optional.

 

  • Pass the 'ap' object to the request:

    Code Block
    languagejava
    rsr.setPerson(ap);
    

 

  • Once the request is configured, carry out the call:

    Code Block
    languagejava
    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 ADDUSER function. To use it for yourself, carry out the following the steps:

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

 

Code Block
languagejava
<%            
/*              ws_adduser.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("ADDUSER");


AdministrationPerson ap = new AdministrationPerson();


ap.setUserId("john.smith@yellowfin.com.au");  // if Yellowfin authentication option is set "email address"
ap.setFirstName("John");
ap.setLastName("Smith");
ap.setRoleCode("YFREPORTCONSUMER");                // Yellowfin role codes can be found performing this query against 
												   // Yellowfin configuration database: SELECT * FROM OrgRole

ap.setPassword("test");                     	   // Password must comply with your Yellowfin password policy 
ap.setEmailAddress("john.smith@yellowfin.com.au");
rsr.setPerson(ap);


AdministrationServiceResponse rs = adminService.remoteAdministrationCall(rsr);

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

 

 

...

Expand
titleADDUSERS

 

This function creates users in bulk. It works is similar to the ADDUSER function, however this requires that you pass an array of AdministrationPerson objects.

Note: Ensure that you mention the proper name of this function, which is ADDUSERS.

 

Complete Example

Below is a complete example of the ADDUSER function. This example code adds two new Yellowfin users, user1@yellowfin.com.au and user2@yellowfin.com.au, in the default organization.

To use it for yourself, carry out the following the steps:

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

 

Code Block
languagejava
<%            
/*              ws_addusers.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("ADDUSERS");

AdministrationPerson[] ap = new AdministrationPerson[2];

ap[0] = new AdministrationPerson();
ap[0].setUserId("user1@yellowfin.com.au");         
ap[0].setFirstName("user1");
ap[0].setLastName("Lastname1");
ap[0].setRoleCode("YFREPORTCONSUMER");          
ap[0].setPassword("test");                                 
ap[0].setEmailAddress("user1@yellowfin.com.au");

ap[1] = new AdministrationPerson();
ap[1].setUserId("user2@yellowfin.com.au");         
ap[1].setFirstName("user2");
ap[1].setLastName("Lastname2");
ap[1].setRoleCode("YFREPORTCONSUMER");          
ap[1].setPassword("test");                                 
ap[1].setEmailAddress("user2@yellowfin.com.au");


rsr.setPeople(ap);


AdministrationServiceResponse rs = adminService.remoteAdministrationCall(rsr);

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


 

 

...