StrataFrame Forum

Permission Question

http://forum.strataframe.net/Topic10782.aspx

By Tim Dol - 8/8/2007

My default permission action is set to deny permissions.  I'm writing a routine to loop through a tab control setting the visibility of each tab based on permissions but I only want to check permissions if a permission key exists.

Is there something built in for checking the existence of a permission key, other than using the business object directly or is there a better approach.

Thanks

Tim

By Tim Dol - 8/14/2007

Just following up on this issue. Any idea's

Thanks.

By Trent L. Taylor - 8/14/2007

If you wanting to know if a permission exists regardless of the logged-in users permissions, then you will need to query the BO.  The easiest thing would be to create a scalar method that accepts the key then just returns the count of keys found.  This would be the fastest way.  Our BO rules just check for a duplicate, so you will want to query this yourself.

Dim loCommand As New SQLCommand()
loCommand.CommandText = "SELECT COUNT(*) FROM SFSPermissions WHERE pm_key=@pm_key"

loCommand.Parameters.Add("@pm_key",VarChar)
loCommand.parameters(0).value = "YourKey"

If CType(Databasics.DataSources("").ExecuteScalar(loCommand), Integer) > 0 Then
   '-- It exists
End If

By Tim Dol - 9/4/2007

I created a PermissionsBO (Mapped to DDT) and created a routine similar to the one you suggested.  When I execute the code  I get the following message when setting the SQL Command Text.

"A class derived from MicroFour.StrataFrame.Business.BusinessLayer must override the property 'TableSchema'"

I have never seen this error before on a BO.  Do I have to do something special for the Permissions Business Object?

Thanks

Tim

By Trent L. Taylor - 9/5/2007

I have never seen this error before on a BO.  Do I have to do something special for the Permissions Business Object?

More than likely you did not build the partial class for the BO.  The TableSchema is an abstract property that must be overwritten.  If you look at another BO you will see what this property contains.  Let me know if you need more explanation.  Smile