use sde go select distinct Layer = Object_Name(major_id) from sys.database_permissions dp join sys.database_principals grantee on dp.grantee_principal_id = grantee.principal_id JOIN sys.database_principals grantor on dp.grantor_principal_id = grantor.principal_id where state_desc like 'Grant%' and permission_name = 'select' and grantee.name = 'ims_read' and not object_Name(major_id) like '[adfis][1-9]%'and not object_Name(major_id) like 'SDE_%'
#Script to grant privileges on mass from one SDE user to another #Author - Martin Ashmore #Date - 19/12/2012 #Import the arcpy module containing Arc tools import arcpy #Import the time module to allow access import time #Set the user to who rights will be granted to user ="ims_read" #Set the workspace to be used by all tools - in this instance the sde connection that is granting access. The path to the file is accessed from properties of the connection in ArcCatalog arcpy.env.workspace = r"C:\Documents and Settings\pdomja\Application Data\ESRI\Desktop10.0\ArcCatalog\DC gis_admin svgisdb2.sde" #Create an error indicator, this will be set if an error is encountered processing the layers err = 0 #Create an object to open the file containing the layers to be shared to the ims_read connection inF=open(r"C:\temp\imsSelect.csv","r") #Create an object to open a log file to hold the results of the processing outF=open(r"C:\temp\grant_log.log", "w") #Read the contents of the file from the file into a list comprised of strings. The splitlines() function removes end of carriage returns (\n) layer = inF.read().splitlines() #Close the file now the data has been read from the file inF.close() #Obtain time to be writtern to the log file curTime = time.asctime(time.localtime(time.time())) #Write preprocessing information into logfile outF.write("***************************************************************\n") outF.write("Processing of files at: "+curTime+".\n\n") #Loop through the list, for each value grant permissions for ims_read to select the data for v in layer: #error handling - try the following statement try: #use the arcpy tool ChangePrivileges to grant select permission for each object in the list arcpy.ChangePrivileges_management( v, user, "GRANT") #Write to screen layer when privileges successfully changed print "Processing layer : "+v #Write to log file layer when privileges successfully changed outF.write("Processing layer : "+v+"\n") #If an error occurs processing the current layer thenn echo out the Following statement except: #Write to screen if layer fails processing print "****Layer :"+v+", could not be processed.****" #Write to log file layer if layer fails processing outF.write("****Layer :"+v+", could not be processed.****""\n") #Set the error flag for later err = 1 #Loop ended #Check whether any of the layers have failed processing and inform that the user #Start If statement #If error code is 1, report errors otherwise report processing sucessfully if err == 1: print "*********************************************************" print "Process completed with errors at : "+curTime+"." print r"Consult processing log file: C:\temp\grant_log.log" outF.write("\n*********************************************************\n") outF.write("Process completed with errors at : "+curTime+".\n") else: print "*********************************************************" print "Processing completed sucessfully at : "+curTime+"." outF.write("\n*********************************************************\n") outF.write("Processing completed sucessfully at : "+curTime+".\n") #End of If statement #Close the log file outF.close() #End of script
I'm new to this side of SDE (desktop user before), what do you mean by F, S and I?
figure out what the F, S, I, adds, deletes, etc tables are associated to this featureclass and grant the appropriate user/role access
Hi,As there are quite a lot of users and loads of layers I was thinking about doing this at the database level, rather than manually going though them.
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.