Creating an NIS editor user
The nis user created previously is a data owner. Anybody connecting as the owner can delete the NIS tables or make any schema changes. To protect the NIS, an editor user can be created to edit data. The examples below show how to create a geodatabase editor user to access the NIS.
Create the editor login.
USE master
GO
EXEC sp_addlogin N'nis_editor', 'editor', @logindb, @loginlang
GO
Create user.
--use nisdb database
USE [nisdb]
GO
CREATE USER [nis_editor] FOR LOGIN [nis_editor]
GO
Grant privileges.
--use nisdb database
USE [nisdb]
GO
EXEC sp_addrolemember N'rlniseditor', N'nis_editor'
GO
Verify user permissions.
--use nisdb database
USE [nisdb]
GO
select USER_NAME(p.grantee_principal_id) AS principal_name,
dp.type_desc AS principal_type_desc,
p.class_desc,
OBJECT_NAME(p.major_id) AS object_name,
p.permission_name,
p.state_desc AS permission_state_desc
from sys.database_permissions p
inner JOIN sys.database_principals dp
on p.grantee_principal_id = dp.principal_id
where USER_NAME(p.grantee_principal_id) = 'nis_editor'
GO
Creating an NIS viewer user
Additionally, a viewer user can be created to provide read-only access to the NIS. The examples below show how to create a geodatabase viewer user to access the NIS.
Create the viewer login.
USE master
GO
EXEC sp_addlogin N'nis_viewer', 'viewer', @logindb, @loginlang
GO
Create user.
--use nisdb database
USE [nisdb]
GO
CREATE USER [nis_viewer] FOR LOGIN [nis_viewer]
GO
Grant privileges.
--use nisdb database
USE [nisdb]
GO
EXEC sp_addrolemember N'rlnisviewer', N'nis_viewer'
GO
Verify user permissions.
--use nisdb database
USE [nisdb]
GO
select USER_NAME(p.grantee_principal_id) AS principal_name,
dp.type_desc AS principal_type_desc,
p.class_desc,
OBJECT_NAME(p.major_id) AS object_name,
p.permission_name,
p.state_desc AS permission_state_desc
from sys.database_permissions p
inner JOIN sys.database_principals dp
on p.grantee_principal_id = dp.principal_id
where USER_NAME(p.grantee_principal_id) = 'nis_viewer'
GO
Creating database connections for NIS users
Database connections need to be created for the other NIS users. Create a database connection in ArcCatalog with the NIS_EDITOR and NIS_VIEWER users.
For more information, see Database connections in ArcGIS for Desktop