Unable to link assigned Storage Groups back to original storage groups

Mar 19, 2010 at 11:21 AM
Edited Mar 19, 2010 at 11:24 AM


I seem of hit a brick wall with my code.  I have almost  completed writing a UI to wrap the NetSqlAzMan into a control inside my application but I am having problems retrieving assigned storage groups.  I first list the storage groups as checkboxes, the user checks the boxes by the side of the storage groups they want assigned and I assign the storage groups to the role etc.  This all works fine.  However, when I want to allow editing I am finding there is no link between the assigned storage group and its original state. i.e. A storage group might have an ID of 8 however when it is assigned it is given an AuthorizationId of say 22.  When reading the assigned storage groups back (using GetAuthorzations) there doesn't appear to be any way to link the assigned to the original storage group as the assigned groups don't appear to contain the original storage group name or Id so I really need to link back to the original to get the name of the storage group that has been assigned so I can display the name and check the checkbox to say it has already been assigned.  I hope this makes sense as I am stumped at the moment and could really do with this resolving.  There is probably a way to do it but I just can't seem to find it.


Mar 19, 2010 at 11:29 AM

Could you post your source code ?



Andrea Ferendeles
NetSqlAzMan Project Coordinator  
E-mail aferende@hotmail.com Web http://netsqlazman.codeplex.com

Mar 19, 2010 at 12:04 PM
Edited Mar 19, 2010 at 12:24 PM

My code is really huge as I have tried to implement all NetSqlAzMan but I will try to paste bits and hopefully explain them enough for them to make sense.

This is my grid where I display the storage group items.  These items are just basic storage groups and have not been assigned to anything.  This is where the storage group id is 8 from my previous description as they are just basic storage groups full of users that have not been assigned to any items (Role, task, operation).


                    <asp:GridView ID="StorageGroupsGrid" runat="server" AutoGenerateColumns="False" AutomaticPostbackEnabled="False"
                        EnableViewState="False" ShowHeader="False" GridLines="None" CssClass="storeGroups">
                        <RowStyle CssClass="dataRow" />
                            <asp:TemplateField HeaderText="ItemId">
                                    <asp:Label ID="UserIdLbl" runat="server" Text='<%# Bind("StoreGroupId") %>' CssClass="dataItem"
                                <HeaderStyle CssClass="hiddenColumn" />
                                <ItemStyle CssClass="hiddenColumn" />
                            <asp:TemplateField ShowHeader="False">
                                    <asp:Label ID="Name" runat="server" Text='<%# Bind("Name") %>' CssClass="dataItem"
                                <HeaderStyle HorizontalAlign="Left" />
                                <ItemStyle Width="150px" />
I read the grid in JQuery using the class names $(".storeGroups); and then iterate over all the rows and read the StoreGroupId and Name columns into a java method that creates checkboxes on a JQUery dialog.
Users check the checkboxes they want and using WCF I use the standard NetSqlAzMan calls to assign the storage groups to the items (roles, tasks, operations).
Next, users wish to edit their selections and add or remove storage groups from their items (roles, tasks, operations), this is where my problem lies.
I use the following to read all the assigned authroizations into a label which resides in another grid. MemberAuthorizationLbl is the name of the hidden label column on the grid.  However when I read the
authorizations back the id or AuthorizationId is now 22 and there is nothing in the dataItem.Authorizations to link the assigned storage group back to the orignal one.  I need to get the original Id of 8
and or the storage groups name as neither of these appear in the assigned authorizations list.  I have also tried using (GetAuthorizations) to see if that method returned something that linked the 2 
things together, but again it didn't.
        protected void AvailableGrid_RowDataBound(object sender, GridViewRowEventArgs e)
            string gridPrefix = string.Empty;

            if (e.Row.RowType == DataControlRowType.DataRow)
                IAzManItem dataItem = e.Row.DataItem as IAzManItem;
                Label memberAuthorizationsLbl = e.Row.FindControl("MemberAuthorizationLbl") as Label;

                foreach (IAzManAuthorization azman in dataItem.Authorizations)
					// I get the Id's here of the assigned authorizations and but them into a field within the grid.  I need the Ids and the types (Store, Local, Database)
					// All my code apart from this grid event is in javascript so I read the grid field in java to get the data client side. memberAuthorizationsLbl is a label control
					// within a cell in my row on the gridview control
                    memberAuthorizationsLbl.Text += azman.AuthorizationId.ToString() + "|" + azman.SidWhereDefined.ToString() + ";";
So I have my originaly list of storage groups in the StorageGroupsGrid and I have them as checkboxes within my java dialog, these have an id of 8 and a name.  But my memberAuthorizationsLbl has the 
assigned storage group id of 22 (AuthorzationId) with no name for the storage group so I seem to have no way of linking the original storage group with the assigned one in order to check the correct checkbox
in my java dialog.
Mar 19, 2010 at 12:11 PM

Please post also the code fragment when you write the authorizations for the Storage Groups.


Mar 19, 2010 at 12:46 PM
Edited Mar 19, 2010 at 12:52 PM

Eek, I have not actually done this but I was assuming it was just something like the following.

IAzManStoreGroup storeGroup = newStore..GetStoreGroup("MyStorageGroup);     // using the name from the label control that is linked to the checkbox.

Role.CreateAuthorization(storeGroup.SID,WhereDefined.Store, storeGroup.SID, WhereDefined.Store, AuthorizationType.AllowWithDelegation, null, null);


Mar 19, 2010 at 12:58 PM

Hmm, I have a feeling I am going to have to use the SID's instead of the Id's and write a WCF method that takes the AuthorizationId, gets all the original stoage groups plus the authorization based on the authorisationId and just do a foreach on the storage

groups until I match the SID's. then return the ID and name I need.

Mar 19, 2010 at 2:00 PM


You should use the ObjectSID of IAzManAuthorization objects  instead of the ID.

Let me know,


Andrea Ferendeles
NetSqlAzMan Project Coordinator  
E-mail aferende@hotmail.com Web http://netsqlazman.codeplex.com