Tuesday, July 26, 2011

Business Objects – the basics

Here is some basic information relating to Business Objects which you may find useful..

Setting Up the Server

  • Go to the installer directory
  • Run the "Setup.exe"
  • Note: you’ll need the product code
  • Take all the default settings.

Web Services Available

When installed Business Objects provides 2 main services over the web.
  1. InfoView (:6405/InfoViewApp/logon.jsp">http://<server>:6405/InfoViewApp/logon.jsp); this is the main interface for Users within the Organisation
  2. Central Management Console (:6405/CmcApp/logon.faces">http://<server>:6405/CmcApp/logon.faces) ; this is the administration and control interface for Power Users and Support staff.

Creating and Managing Users

Access the Central Management Console (:6405/CmcApp/logon.faces">http://<server>:6405/CmcApp/logon.faces and click on the User/Group Tab or select "Users and Groups" from the option drop down at the top of the page.

You can create a new User or Group by clicking on the "User List" node and selecting the "New User" icon or "New Group" icon on the menu.

Equally you can edit User/Group details by clicking on the name on the right of the screen.

After you have modified the details you should click "Save" on the bottom right of the screen.

Wednesday, February 2, 2011

Encrypting Web.Config part 2

Someone noted that my previous script for encrypting web.config files was missing out some applications and I discovered it was because they where at the root level and my script expected everything to running under a virtual directory.  This was correct for the development machines but on a production machine the site could be anywhere.

Working by file

To fix this I changed the script to simply find all the web.configs on a specific drive and do it that way.  It turned out to be easier than going via IIS and probably more accurate too.  There modified script is below:

$Dir = get-childitem G:\ -recurse
$List = $Dir | where {$_.name -eq "web.config"}

## Sections we want Hashed ###
$configSections = @('connectionStrings','appSettings')
## Command line for the encrypting system ###
$CmdLine = "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis -pef "

foreach($file in $List)
{
    ### Process the directories ###
    write-Host "processing  -> " $file.fullname;
    foreach($section in $configSections)
    {
        $command = $CmdLine + $section + " " + $file.fullname + "' -prov 'RsaProtectedConfigurationProvider'";
        #invoke-expression -command $command | out-null
    }

}

Tuesday, February 1, 2011

Encrypting Web.Config

Today I spent a few hours getting a script together that would encrypt all the web.config files for all the sites and applications on a server.   It was more difficult than expected, but I think that’s more because I don’t really know PowerShell as well as I figured.  It was also the fact that our servers are running version 1 rather than version 2 which makes things a little more complicated.

The Script

The script is given below (not much sot show for 4 hours work!). 

### Powershell script to encrypt all web.configs###
$objSites = [adsi]"IIS://localhost/W3SVC"
foreach ($objChild in $objSites.psBase.children)
{
    $sitePath=$objChild.psBase.Path + "/Root";
    Write-Host "Processing Site:" + $sitePath;
    $iis=[adsi]$sitePath;
    $vroot = $iis.psbase.children ;
    trap  { continue;}

    ## Sections we want Hashed ###
    $configSections = @('connectionStrings','appSettings')
    ## Command line for the encrypting system ###
    $CmdLine = "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis -pe "
    ### Process the directories ###
    foreach($vdir in $vroot)
    {   
        Write-Host "processing  -> " $vdir.psBase.Name;
        foreach($section in $configSections)
        {
            $command = $CmdLine + $section + " -app '/" + $vdir.psBase.Name + "' -prov 'RsaProtectedConfigurationProvider'";
            invoke-expression -command $command | out-null
        }
    }
}

In essence its a simple loop, find all teh defined sites, then all the virtual directories below these.  Run teh command line utility “aspnet-regiis –pe ”, which will work it’s magic.

Powershell

One of the major things you need to have on teh server for this work is PowerShell.  This feature is built into Windows 2008 so all you need to do is enable it by adding the “Microsoft Powershell” feature.  For Windows 2003 you’ll need to download the installation package from Microsoft.

If you’ve installed PowerShell for teh first time tehn you’ll also need to set th Execution Policy.  Just enter “Powershell” at the command prompet and enter “Set-ExecutionPolicy RemoteSigned”, then exit.

 

The Timer Job

The simplest way of making sure that this is always applied to all sites is to create a timer job that runs every hour.

Wednesday, December 15, 2010

BOMGR 0220 errors on Business Objects server

The lads in SKSWood Brunei change the service account running Business Objects this week and it cause the server to bring up BOMGR 0220 errors. Below is the solution…

Steps for solution:

1. Stop the WebI service.

2. Log into the Business Objects Configuration Tool. Start\Programs\Business Objects\Configuration Tool 6.5

3. On the Cluster Manager Page. Go to the Service Parameters branch. At the bottom of the screen there is a drop down - select 'Update Service Parameters'. Edit the username and password. Hit next or finish

4. Refresh the ORB. On the Cluster Manager Page. Select ORB. Select 'Define ORB' from the drop down. Then hit the 'Test Ports' button. Once done, hit next.

5. Hit finish. and close the configuration tool.

6. You change the settings for the Distributed COM Configuration Properties by doing the following:

6.1 Start\Run\type 'dcomcnfg'

6.2 In the Applications Tab, you should see at least BusinessObjects.document

6.3 Click on BusinessObjects.document and select 'Default Security' tab. Ensure that Edit Default for Access Permissions and Launch Permissions includes Interactive, System and the service account you are using.

6.4 Go back to the Applications Tab, select BusinessObjects.document and hit properties.

6.5 Select the Identity Tab. Select 'This User'.

6.6 Type in the new account and password.

6.7 Once you have changed the settings there may be a need to reboot your server.

Monday, December 6, 2010

Mocking a View for Unit Testing

Had a very interesting question yesterday asking if it was possible to mock up a database view along side the in-memory SQLLite database we use for ActiveRecord.  Initially I figured it was a simple matter of just finding some form of attribute within the ActiveRecord class definition but it turns out that this is not the case.  Views not not actually supported by the CreateSchema() method we normally use with NHibernate/ActiveRecord.

As a work around you can create a view using the existing connection, for example I want to create a view called “mockview” which is based on the applications table.  All we need to do this is create a method:

private void CreateMockView()
{
    using (IDbCommand command = service.GetConnection().CreateCommand())
    {
        command.CommandText = "Create view mockview as select applicationid from applications";
        command.ExecuteNonQuery();
    }
}

If there is already an ActiveRecord class definition for this you need to decorate the class with the Schema=”none” parameter which will prevent the creation of a table with the same name.

[Serializable , ActiveRecord("mockview ", DynamicUpdate = true, Lazy = false, Schema="none")]
public partial class ApplicationsDAO : ActiveRecordBase    {
………………………….
}

Now you can query this to your hearts content.

If we want to query this but there is no ActiveRecord table definition we can just use a normal datareader, for example;

[Test]
public void GetApplications_Test()
{
    IList<Application> results = Application.FindAll();      // the AR Class
    Assert.IsTrue(results.Count > 0, "Returned values");
    _log.InfoFormat("GetAll Complete returned {0} records", results.Count);

    using (IDbCommand command = service.GetConnection().CreateCommand())
    {
        command.CommandText = "select applicationid from applications";  // the View on the database
        IDataReader reader = command.ExecuteReader();
        Assert.IsTrue(reader["applicationid"].ToString() == “1”, "there should be records in the view!");
    }
}

Wednesday, November 24, 2010

Authentication against Active Directory and ADAM

Today we were doing some work with authentication to see if we can improve the way it’s done on the external environments, Corp Website, Xtranet and the CEBs.  The plan was to use ADAM (Active Directory Application Mode) but this would mean a lot of nice features that are out-of-the-box with Active Directory.

To test both options I created a simple winform that will verify both options.

image

Using Active Directory

This is very well supported in the .Net Framework, you can use the built-in .Net references:
System.DirectoryServices.AccountManagement;
System.DirectoryServices;

Here is the code;

try

  // create a "principal context" - e.g. the domain (can also be a machine, too)
    using (PrincipalContext pc = new PrincipalContext(ContextType.Domain, txtDomain.Text))
    {
        // validate the credentials
        if (pc.ValidateCredentials(txtUsername.Text, txtPassword.Text))
            lblStatus.Text = "Login successful!";
        else
            lblStatus.Text = "Login unsuccessful!";
    }
}
catch (Exception ex)
{
    lblStatus.Text = ex.Message;
}

The PrincipleContext connects you to the domain, while the ValidateCredentials method will return True if its a valid name/password pair and false if not.

Using ADAM

This is not as well supported but it is there if needed.

try
{
     using (DirectoryEntry entry = new DirectoryEntry(txtPath.Text, txtUsername.Text, txtPassword.Text))
     {
         try
         {
             if (entry.Guid != null)
                 lblStatus.Text = "Login successful!";
             else
                 lblStatus.Text = "Login unsuccessful!";
         }
         catch (NullReferenceException ex)
         {
             lblStatus.Text = ex.Message;
         }
     }
}
catch (Exception ex)
{
     lblStatus.Text = ex.Message;
}

Here we create a Directory entry and connect to it using an LDAP path.  That is we tell the application where to find the Users information.  In my form I used; LDAP://localhost:389/cn=Groups,cn=XXX,cn=YYY,dc=ZZZ

The important thing here is that the address is entered in reverse order.  You enter the container for the User, then the container in which the User is located and ten any other container and so on until the top.

Someone might find it useful, but I’m happy to stick with Active Directory.

Friday, November 19, 2010

Setting up Email reporting using Business Objects

Today I had to configure Business Objects to send reports via email. Here are the steps needed to complete the task.

Configuring the server
  1. Logon to the Central Management Console as an Administrator

  1. From the drop down list select "Servers" and on the left select "Servers List"

  1. The server that runs the reports is called the "<servername>.AdaptiveJobServer" double click this to bring up the configuration settings and select Destination from the options on the left.
  2. From the Destination Drop down select "Email" from the list and click "Add".

  1. Enter the following details and then click "Save & Close"

    1. Domain Name: POG
    2. Host: <whatever>
    3. Port:25
    4. Authentication: None
    5. Click "Deliver Document(s) as Attachments
    6. Click "Use automatically Generated Name"
Scheduling a Report to be sent via email
  1. From the Central Management Console select Folders
  1. Using the folder list navigate down the folder list until you find the report you wish to schedule. When you find the report, double click and select "Schedule" from the left hand menu. This menu allows you to set up all the options you need, e.g. running hourly, weekly, who gets the email, output format etc.
  2. Click "Schedule"
  3. On the History List you will be able to see if the report was successfully generated and sent.