Dynamics User Group
Since 1995 - The Microsoft Dynamics Online User Community

Navision SQL Roles

rated by 0 users
This post has 25 Replies | 3 Followers

Not Ranked
Posts 10
Points 250
Member since 10-14-2008
pwellar Posted: 10-14-2008 23:33

Hi,

 I'm having a problem where a User which is granted SUPER roles in Navision gets an error when doing a transaction.

The following SQL Server error(s) occured while accessing hte PW Inventory - Lot table:

1088, "42000", [Microsoft][ODBC Sql Server Driver][Sql Server]Cannot find the object "3PLink_Database43_SQL.dbo.Coast 2000 Terminals Ltd_$PW Inventory - Lot" because it does not exist or you do not have permissions.

 SQL: SET IDENTITY_INSERT "3PLink_Database43_SQL","dbo"."Coast 2000 Terminals Ltd_$PW Inventory - Lot" ON

I know I can post successfully but a few other Users can't. I was under the impression that SQL Server used Application Roles so there should be no connection between the fact that I am a Sys Admin and the rest are Users. If I look at all the Application Roles they all have the same permissions with Delete, Insert, Select and Update all set to Grant on this table. I was trying to figure out a way to map the user to the Application Role but I was not aware of anything. Any help would be greatly appreciated.

Running SQL Server 2005 and Navision 4.0 sp3.

Thanks,

Paul

Top 10 Contributor
Male
Posts 5,419
Points 67,513
Member since 04-12-2001
DynamicsNAVMVP
Moderator
SystemAdministrator

 At first glance it looks like you may be set to Enhanced Security Model.You might want to try in a test environment to use standard.

David Singleton - MVP Dynamics NAV Dynamics NAV Consultant since 1991 Available for Navision Go-Live assistance
Dynamics Book
  • | Post Points: 5
Top 75 Contributor
Male
Posts 311
Points 4,455
Member since 11-06-2005

"SET IDENTITY_INSERT "  is a built in SQL permission that is granted to DB_Owner and higher only.  You can't assign it. You get this message because you are attempting to insert a non-zero value into an auto-increment field.  You need to review and correct your code.  Do not assign DBO priviliges to get around this.

 

 

  • | Post Points: 45
Top 75 Contributor
Male
Posts 311
Points 4,455
Member since 11-06-2005

Being SA is exactly why you do not get this error.  SA is granted this right on all databases.  SA rights are not suppressed by application roles.

 

  • | Post Points: 5
Not Ranked
Posts 10
Points 250
Member since 10-14-2008

Ahh that makes sense now. I will have the company look into their code. However is it better to being on Enhanced or Standard security as I have read many different things with this. Also if I do switch it to Standard how do I support the database logins? Do I need to add the Database logins as users in the SQL Database?

 Thanks,

Paul

  • | Post Points: 20
Top 75 Contributor
Male
Posts 311
Points 4,455
Member since 11-06-2005

Switch to standard.  I can't think of a good reason to use Enhanced.  I asked MS support if they could give me a scenario where it made more sense to use Enhanced.  They were not able to.

I don't get your question about database users.  You need to set them up in SQL no matter what security model you are using.

 

  • | Post Points: 20
Not Ranked
Posts 10
Points 250
Member since 10-14-2008

Because I was only using Database Logins for my RF Handhelds I didn't need to synchronize the Permissions hence I didn't need them on the SQL database. This was how it was setup and I really never questioned it, now however I will add them as it never really made sense to me in the first place.

 Thanks for the help!

  • | Post Points: 5
Not Ranked
Posts 10
Points 250
Member since 10-14-2008

This is the reponse I got from my customer. Could you please let me know if this is exceptable or not.

1Go to the server console and launch SQL Enterprise Manager
2Expand the (local) server > Databases > and the Navision SQL Database
3Click Roles. In the right pane, double-click ‘db_owner’
4Click Add, then select ‘$ndo$shadow’ and click ok.
5Click Ok in the Database Roles Properties window

Thanks,

Paul

  • | Post Points: 30
Top 75 Contributor
Male
Posts 311
Points 4,455
Member since 11-06-2005

No this is not correct.  There is NO reason for a normal NAV user to EVER be a DB_owner

 

 

  • | Post Points: 20
Top 75 Contributor
Male
Posts 311
Points 4,455
Member since 11-06-2005

This is a coding issue.  I see this often when a developer will work in a native DB and deliver code that will be run in SQL. This behavior is quite different between the two. A common oversite is to use Rec.INIT and forget that it does not clear the primary key fields.

 

 

  • | Post Points: 5
Not Ranked
Posts 10
Points 250
Member since 10-14-2008

That is what I thought, however they are basically telling me that they aren't willing to change all there code as this works perfectly fine on a native database. Is there any risks with doing this for a short term fix? Any security risks?

 Thanks,

Paul

  • | Post Points: 35
Top 75 Contributor
Male
Posts 311
Points 4,455
Member since 11-06-2005

See my previous post.  SQL behaves differently then native in some areas.  When developing for a SQL site the testing needs to be done in SQL.  If not you set yourself up for nasty surprises like this.

Making everyone DB_Owner is the SQL equivalant of making all your network users members of the administrators group.  I strongly advise against this approach.

 

  • | Post Points: 20
Not Ranked
Posts 10
Points 250
Member since 10-14-2008

My understanding with this is that it will only make Navision users a member of hte administrator group. Therefor only when coming through the application does it appear this way but not when they are accessing the database through Windows credentials? Or am I misunderstanding how this works.

 

  • | Post Points: 20
Top 10 Contributor
Male
Posts 5,419
Points 67,513
Member since 04-12-2001
DynamicsNAVMVP
Moderator
SystemAdministrator

pwellar:
they are basically telling me that they aren't willing to change all there code as this works perfectly fine on a native database

 

You are kidding right Surprise

 

Who are "they"? Do you mean the Navision partner that supports them, or a thrid party company that developed the code?

David Singleton - MVP Dynamics NAV Dynamics NAV Consultant since 1991 Available for Navision Go-Live assistance
Dynamics Book
  • | Post Points: 35
Not Ranked
Posts 10
Points 250
Member since 10-14-2008

The actual third party company that developed the code, I am sure I can get them to do this over time but they aren't willing to do it in the short term thats for sure.

  • | Post Points: 35
Page 1 of 2 (26 items) 1 2 Next > | RSS


Copyright Dynamics User Group, 1995-2009, all rights reserved. The Dynamics User Group is not affiliated with Microsoft Corporation.