UMRA COM - Role Based Access Control (RBAC)

9:12 PM / Comments (0) / by Tech Admin

If you haven’t already download the free trail version of User Management Resource Administrator here > Download

If you want to learn the basics on how to connect to UMRA with its COM object, please see my original post on “Basics of UMRA COM”.Role Bases Access Control (RBAC) is huge in any Active Directory environment, and during the creation of a few of the projects I’ve had to build, I was tasked with using UMRA to handle the RBAC on a internet/intranet webportal. How can UMRA handle and manage RBAC in a web portal? Very easily, since UMRA has the abilty to work hand in hand with your Active Directory and other ODBC Databases. We can now have IIS pull back the user who is accessing the portal with “Microsoft’s Integrated Authentication”, then have UMRA take this users information, and go into active directory pull back different attributes from user, and even go into other ODBC databases, and pull additional information from the user. Then on our webpage, we can have different functions, to figure out what type Role Bases Access the users has.

I will show you one example below, of how I was able to handle a specific clients request to have 2 RBAC types, one is “Admins”, and the other is “IT Staff”. The way the Users were separated in Active Directory was by specific group memberships. Admins – were part of “domain admins” and IT Staff – was part of “IT Staff”.

Below is how I would check what RBAC a specific user has when trying to come into a access a company web portal. There are 2 portions to this script, 1 is the UMRA script itself, all it has in it is, 1 “Get user (AD)” and “Get Attribute (AD), the Get Attribute will get the “memberof”, these are the groups the User is a part of.. If you need help setting this script up, please see my posts here:

Below is the example VBScript:
'Create/Set Variables

Dim RetVal
Dim UMRA_Server
Dim UMRA_ Port
Dim UMRA_Project

UMRA_Server = "MyServerName"
UMRA_Port = 56814
UMRA_Project = "Get User Details"

'End Create/Set Vairbales

Set Umra = Server.CreateObject("UMRAcom.Umra") ' Creates a new reference to the UMRACom DLL

RetVal=Umra.Connect(UMRA_Server,UMRA_Port) ' Use the "Connect" Method, it will take 2 paramaters UMRA_Server and UMRA_Port
RetVal=Umra.ExecuteProjectScript(UMRA_Project) ' Use the "ExecuteProjectScript
Method, takes 1 paramater UMRA_Project.

if RetVal = 0 Then ' Check to see if we are connected to the UMRA project

Umra.SetVariableText "%usergroups%", usergroups ' Get the variable in the UMRA project

'Check User Group Memberships

if InStr(usergroups,"domain admins") >= 1 Then
Session("User_Type") = "Domain Admin"
else if InStr(usergroups,"domain admins") >= 1 Then
Session("User_Type") = "IT
Staff"

else
Session("User_Type") = "No Access"
end if

end if
And there you have it, you now have a vbscript that will check to see if the user who is accessing the portal, is of a RBAC you’ve set, and if not, set a session for that.

Blog Update July 28th 2009

I am going to update this blog since any UMRA Portal is going to have some type of User Access Control on it. The above UMRA Example is a great way to get your User RBAC types in and functional, however alot of the times, your RBAC types change on a daily or monthly basis, so having to update the UMRA Portal code each time this happens might be a little tuff to do since there could be alot of pages you will need to update. So what is the new approach to this method? The new approach that I use is to intergrate a database and RBAC creation / edit form into the mix. We can still hard code the first RBAC type into the UMRA Portal and this will never change. Typically what I will do is just hardcode one group "Domain Admins" if you are part of this group, you will have the ability to edit RBAC types on the fly, adding, modifying etc. on the fly. Typically I will store this data in an access database, however, MSSQL is perferable if its avaiable, I will store the RBAC type, and what group its binded to. But then I will take this a step further, and we can talk about the logistics of this later...but I will also link this into what function are "in" the portal. A function like "Manage Users", or "Password Reset" are examples of functions, these can be turned off/on depending on what you want your new RBAC to control. So now you are able to create UMRA based Roles on the fly, bind them to an Active Directory Group, then set Function level access all on fly, you dont need to code custom pages anymore.

Now, we will stay on the concept of being able to control your UMRA Portal dynamicly from an admin menu, and talk about some more of the nifty things you can do to help ease your RBAC type changes. Since you now have a quick menu to control RBAC types, you can now get more granular with your functions. So for example, instead of turning something off/on for a certin RBAC type, you can now have it so these functions can go into workflows or pass through and hit Active Directory. So for example, if you just created an "Manger Level 1" RBAC type, and binded it to the group "Seattle Managers", anyone who has this group membership in Active Directory will be set as "Seattle Managers". Now, you will allow this RBAC type to edit a users firstname and lastname, however you dont want it to hit Active Directory right away, maybe you want it to go into a workflow to email "IT Staff" with a ticket to let you know that user xxxx wanted to change joe's firstname to "Billy" if "IT" approves this, then it would then hit Active Directory, but if "IT" didn't approve this, it would email associated parties and advise. Now on the flip side, maybe you have another RBAC type called "Baltimore Managers" they can do the same thing as "Seattle Managers" however, when they edit a users firstname or lastname, it will hit Active Directory. As you can see these are some very handy ways to really control your RBAC types, and functions in your portal on the fly, no need to code any new logic.

UMRA COM Object - Loop Through Data Table

9:52 AM / Comments (0) / by Tech Admin

If you haven’t already download the free trail version of User Management Resource Administrator here --> Download

If you want to learn the basics on how to connect to UMRA with its COM object, please see my original post on “Basics of UMRA COM”.If you’ve been following my blog you will see I’m a huge fan of UMRA and it’s ability to handle Identity Management of Active Directory Objects in a quick and user friendly fashion. In my previous post we talked about how we can use the UMRA COM method “connect” to talk to UMRA through a web page. We also know how to send data to UMRA COM and pull data back out of our projects. The example on our last blog post simply pulled and set data with the UMRA COM. Now, I will show you how I was able to create a table of data in a UMRA script, and loop through that table on a webpage.

How will this help you, you may ask? You will now have the ability of creating a table of data, it could be any set of Active Directory Objects. Maybe you want to pull all the users and a few attributes out of Active Directory….you can do this now.

So let’s get started, go ahead and open up UMRA if you haven’t already. Now drag/drop the action “Generate generic table”. This action can be found under the tree Variable actions --> Table --> Generate generic table.Here are the steps to configure the “Generate generic table” action.
Step 1: Double click on the “Generate generic table” table action in your script
Step 2: Click on “Configure…”
Step 3: In the “Table type” drop down select “LDAP query (Active Directory, Global Catalog)..
A. You will now see more options at the top of your script action

Step 4: Click on “LDAP Filter” tab
Step 5: Click the Drop down for “LDAP search Filters” and select “All Users” and click the “Insert” button
Step 6: Click the “Attributes” tab
Step 7: Click the “Add” button, to add these Attributes: sAMAccountName, DisplayName, Description
Step 8: Click the “Variable” tab and give the “Variable Name” %user_table%
Step 9: Click the “Run Test” tab, and then click the “Test…” button, you will now see your Users in the Table data area.

So now that we have a table of data, in our UMRA script, we now need to make a webpage, that will link up to this script, and loop through the tables contents.

Copy and Past this into a .asp webpage, and run it. Please see the notes on the script, since there are a few things you will need to change.

VBSCRIPT

'Create/Set
Variables

Dim RetVal

Dim
UMRA_Server

Dim
UMRA_Port

Dim
RowIndex


UMRA_Server =
"MyServerName"

UMRA_Port =
56814

RowIndex =
0
'End
Create/Set
Vairbales

Set Umra
= Server.CreateObject("UMRAcom.Umra") ' Create a New Instance of
UMRA
Set
UmraDataTable = Server.CreateObject("UMRAcom.UmraDataTable") ' Create a New
Instance of
UMRAcDataTable


RetVal=Umra.Connect(UMRA_Server,UMRA_Port) ' Connect to
UMRA

Response.write "Connection to UMRA:" & RetVal &
"
"

if
(RetVal=0)
then


RetVal=Umra.ExecuteProjectScript("My UMRA Script Name") ' Connect to your UMRA
script

Response.write "Connection to UMRA Script:" & RetVal &
"
"


if (RetVal=0)
then


RetVal=Umra.GetVariableDataTable("%UserTable%",UmraDataTable)

Response.write "Connection to UMRA DataTable:" & RetVal &
"
"


RowIndex=0 ' Create a new Row
Counter


RetVal=UmraDataTable.GetCellText(RowIndex,0,user_samaccountname) ' Column 0 of
our
datatable

RetVal=UmraDataTable.GetCellText(RowIndex,1,user_displayname) ' Column 1 of our
datatable

RetVal=UmraDataTable.GetCellText(RowIndex,2,user_description) ' Column 2 of our
datatable


While
(RetVal=0)


'Here is where we do the loop, and display on the page, the contents of the

Response.write "Account Name:"& user_samaccountname &
"
"

Response.write "Display Name:"& user_displayname &
"
"

Response.write "Description:"& user_description &
"

"


RowIndex1 = RowIndex1 + 1 ' After we get row 0, lets increment to get row 1
etc.



RetVal=UmraDataTable.GetCellText(RowIndex,0,user_samaccountname) ' Column 0 of
our
datatable


RetVal=UmraDataTable.GetCellText(RowIndex,1,user_displayname) ' Column 1 of our
datatable


RetVal=UmraDataTable.GetCellText(RowIndex,2,user_description) ' Column 2 of our
datatable


Wend


else

Response.Write "Form Project Not
Found"

end if
end
if


If everything is working fine, you will all your users in your webpage. If you don’t I added a little bit of error logic into the page, it should give you an idea of where its breaking. With this in mind, we will talk more in my next post about all the cool tips and tricks I found with error logic handling…so until next time!

UMRA COM - Get/Set Data

8:39 PM / Comments (0) / by Tech Admin

If you haven’t already download the free trail version of User Management Resource Administrator here --> Download

If you want to learn the basics on how to connect to UMRA with its COM object, please see my original post on “Basics of UMRA COM”.In this post, I will show you some other cool features and tricks I was able to do after reading some of the UMRA COM object’s library.

So after my first post, I gave a basic example of how we connect to a UMRA project, but now we are going to take it a step further, and send the UMRA project we call with the COM object some variables, as well as get some variables back out of that same project.

So let’s get started shall we!We will first create a new “Automation Project”, and then add a “Set variable” action to the script.

Step 1 – Click File à New à Automation Project
Step 2 – Drag a “Set Variable” action onto the script Open tree Variable Actions à Variable Operation” à Set Variable
Step 3 – Double click on your “Set Variable Action” and configure it like below
A. Variable name: %my_umra_var%
B. Value of variable
a. Value: My Extra Text %text_from_webpage%
b. Type: text
C. Click Apply, then OK

Let me go ahead and explain what we just did. We have 1 variable (%my_umra_var%) in the script that we are going to get the value of . We also have 1 variable(%text_from_webpage%) that we are going to pass to the UMRA script.

Below is a screen shot of how your script should look once you’re at this step:


Ok perfect, we now have our UMRA script, we are now going to create a simple .ASP page that will connect to UMRA via the COM object “connect” method, and push data to our script, as well as pull data from the script.We will follow the same steps as in the previous blog, on how to connect to UMRA via it’s COM “connect” method, see this post here for code.Here is the sample code that will set and get data via the UMRA COM.

VB Script
'Create/Set
Variables

Dim
RetVal

Dim
UMRA_Server

Dim UMRA_
Port

Dim
My_Pulled_UMRA_Variable


UMRA_Server =
"MyServerName"

UMRA_Port =
56814

'End
Create/Set
Vairbales

Set Umra = Server.CreateObject("UMRAcom.Umra") ' Creates
a new reference to the UMRACom DLL

RetVal=Umra.Connect(UMRA_Server,UMRA_Port) ' Use the "Connect" Method, it
will
take 2 paramaters UMRA_Server and
UMRA_Port

'The
SetVariableText Method takes 2 paramaters (Your UMRA Variable Name, Your
Text)

Umra.SetVariableText "%text_from_webpage%","Add this text to my variable"

RetVal=Umra.ExecuteProjectScript(UMRA_Project) ' Use the
"ExecuteProjectScript Method, takes 1 paramater
UMRA_Project.

'The
GetVariableText Method works the same way as the Set, however we are now
getting
databack from UMRA AFTER the Project has
ran.

'The
GetVariableText has 2 paramaters (Your UMRA Variable Name You Want to
Get, Your
Variable You Want to Store the Data
In)

RetVal=Umra.GetVariableText("%my_umra_var%",My_Pulled_UMRA_Variable)

'Now that
we have the variable %my_umra_var% data stored in My_Pulled_UMRA_Variable we
can
now print it out to the
page

Response.write "My Pulled Value is:" &
My_Pulled_UMRA_Variable

If everything is done correctly, you will get a print out on the page saying “My Extra Text Add this text to my variable”. And there you go, you now just pushed data to UMRA COM and executed a project, and retrieved data from it. So what have we learned so far? We learned how to connect to UMRA via the COM with the “connect” method. We are now able to push/get data from UMRA projects. What next? In my next post I will show you have to loop through a table of data!

Connect to UMRA with the COM Object

8:09 AM / Comments (0) / by Tech Admin

Hey everyone… I had to make a new blog about a very nifty tool I’ve been using for sometime now to help with my everyday day to day Active Directory Management. The tool I’ve been using is called User Management Resource Administrator, developed by tools4ever. As you’ve most likely seen in my other blogs about the capabilities of User Management Resource Administrator (URMA for short), I also discovered COM/API support.

What is COM/API support you ask?
Per Wiki: An application programming interface (API) is a set of functions, procedures, methods or classes that an operating system, library or service provides to support requests made by computer programs.
So what does this mean to you? This means you can now call UMRA scripts remotely through the COM, via a VB Script, Command line etc. However, I will show you some example of how I can use the UMRA COM library to access my projects and scripts.

If you haven’t already download the free trail version of User Management Resource Administrator here à Download

To view all the methods start UMRA and go to help, within the help menu type in COM. You will see tons of options on how to use the COM, however we will focus on a few of the UMRA COM methods. Below is an example of how to connect to a UMRA project via the “connect” method, and run a UMRA Script. For now we will not send any data to UMRA or get any data back.

*NOTE*
There is an example project in the UMRA default install folder, so look in your default install directory : C:\Program Files\Tools4ever\User Management Resource Administrator\Example Projects\Automation\ASP\CreateAccount

Here is the snippet of code with some comments to better understand what is going on.You can copy/paste this into a blank .asp page.

*VB SCRIPT*
'Create/Set Variables
Dim RetVal
Dim UMRA_Server
Dim UMRA_ Port

UMRA_Server = "MyServerName"
UMRA_Port = 56814
'End Create/Set Vairbales

Set Umra = Server.CreateObject("UMRAcom.Umra") ' Creates a new reference to the UMRACom DLL
RetVal=Umra.Connect(UMRA_Server,UMRA_Port) ' Use the "Connect" Method, it will take 2 paramaters UMRA_Server and UMRA_Port
RetVal=Umra.ExecuteProjectScript(UMRA_Project) ' Use the "ExecuteProjectScript Method, takes 1 paramater UMRA_Project.

Response.write "If the Return Value = 0 You are connected If the Return Value is not 0 you didn't connect
"
Response.write "Your Return Value is = " & RetVal


When you run this script, you will see a “Return Value” if the value = 0 You were able to connect to the UMRA Server, and Run the Project you created, if you get a number other then 0, there was an error along the way.

For now, this is the basics of how I connected to UMRA through the COM object.
I will post in a bit to show more advanced techniques.

UMRA - Tech Tips

8:07 AM / Comments (0) / by Tech Admin

Hey everyone, I've been using User Management Resource Administrator for a few weeks now, and have found it to be a very flexable, but yet powerful tool.
 
-->