Filling a BO by a permission key


Author
Message
rmoore
rmoore
StrataFrame Beginner (25 reputation)StrataFrame Beginner (25 reputation)StrataFrame Beginner (25 reputation)StrataFrame Beginner (25 reputation)StrataFrame Beginner (25 reputation)StrataFrame Beginner (25 reputation)StrataFrame Beginner (25 reputation)StrataFrame Beginner (25 reputation)StrataFrame Beginner (25 reputation)
Group: Forum Members
Posts: 21, Visits: 84
I have two business objects, LocationsBO and CreditMemosBO. I fill the LocationsBO by a permission key. If the permission is deny I remove the row from the current datatable. Once this LocationsBO is filled, I have all the locations a user has access to. What I want to do is to be able to fill the CreditMemosBO by the LocationIDs that are in the LocationsBO (CreditMemosBO has a foreign key LocationID). I was thinking of using this:



For Each LocationRow As DataRow In loLocations.CurrentDataTable.Rows

For Each CMrow As DataRow In Me.CurrentDataTable.Rows

If SecurityBasics.CurrentUser.GetPermission(LocationRow("RBSPermissionKey").ToString).Action = PermissionAction.Deny Then



If LocationRow("LocationID").Equals(CMrow("LocationID")) Then

MessageBox.Show("removing " & LocationRow("LocationName").ToString)

CMrow.Delete()

End If

End If

Next

Next





but it doesn't work. Is there a better way of filling a second BO based on permissions of a different BO? I could put a permission key in the CreditMemosBO but I don't want the extra overhead of inserting a permission key when a record is added.
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Well I am a little confused as to what you are trying to accomplish...but one thing to keep in mind is that a BO already has an Adding key, which is going to be far less overhead that what I understand you to be doing now.  If you open up a BO in the component designer (double-click the BO) and go to the AddSecurityKey and set the Add to have the permission you are needing to check on.

Obvioulsy you can cycle through and remove any records, but if you do not want them to be persisted back to the database as "Deleted" be sure to call the AcceptChanges() method on the CurrentDataTable after you delete the records, otherwise if you call the Save it will think those records need to be deleted on the server:

MyBO.CurrentDataTable.AcceptChanges()

rmoore
rmoore
StrataFrame Beginner (25 reputation)StrataFrame Beginner (25 reputation)StrataFrame Beginner (25 reputation)StrataFrame Beginner (25 reputation)StrataFrame Beginner (25 reputation)StrataFrame Beginner (25 reputation)StrataFrame Beginner (25 reputation)StrataFrame Beginner (25 reputation)StrataFrame Beginner (25 reputation)
Group: Forum Members
Posts: 21, Visits: 84
Ok. That makes more sense to me now. Thanks for the info!
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Glad to help Smile
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search