privileges

Is there a way to disable updates/deletes but still allow triggers to perform them?

吃可爱长大的小学妹 提交于 2019-11-26 18:33:31
问题 Basically, I want to be able to use the REVOKE command to disable UPDATE and DELETE , but I still want the triggers on a table to update my rows. My triggers perform on newly inserted rows, and update a specific field. So I still want this behaviour, but wouldn't they be disabled with REVOKE or with a RULE . (I saw an SO post) Is there a way to keep using the UPDATE / INSERT commands in TRIGGERS but disabling the rest? 回答1: Yes, this is possible. Triggers are run with the privileges of the

Grant all on a specific schema in the db to a group role in PostgreSQL

喜欢而已 提交于 2019-11-26 18:30:16
Using PostgreSQL 9.0, I have a group role called "staff" and would like to grant all (or certain) privileges to this role on tables in a particular schema. None of the following work GRANT ALL ON SCHEMA foo TO staff; GRANT ALL ON DATABASE mydb TO staff; Members of "staff" are still unable to SELECT or UPDATE on the individual tables in the schema "foo" or (in the case of the second command) to any table in the database unless I grant all on that specific table. What can I do make my and my users' lives easier? Update: Figured it out with the help of a similar question on serverfault.com .

To run cmd as administrator along with command?

这一生的挚爱 提交于 2019-11-26 17:24:17
问题 Here is my code: try { ProcessStartInfo procStartInfo = new ProcessStartInfo( "cmd.exe", "/c " + command); procStartInfo.UseShellExecute = true; procStartInfo.CreateNoWindow = true; procStartInfo.Verb = "runas"; procStartInfo.Arguments = "/env /user:" + "Administrator" + " cmd" + command; ///command contains the command to be executed in cmd System.Diagnostics.Process proc = new System.Diagnostics.Process(); proc.StartInfo = procStartInfo; proc.Start(); } catch (Exception ex) { MessageBox

Detect if Java application was run as a Windows admin

家住魔仙堡 提交于 2019-11-26 16:22:57
I have a Java application. Is there anyway I can tell if the process was run with admin privileges, on Windows 7. I found this code snippet online, that I think will do the job for you. public static boolean isAdmin() { String groups[] = (new com.sun.security.auth.module.NTSystem()).getGroupIDs(); for (String group : groups) { if (group.equals("S-1-5-32-544")) return true; } return false; } It ONLY works on windows, and comes built in to the core Java package. I just tested this code and it does work. It surprised me, but it does. The SID S-1-5-32-544 is the id of the Administrator group in

What is the best way for checking if the user of a script has root-like privileges?

北城以北 提交于 2019-11-26 15:57:11
问题 I have a Python script that will be doing a lot of things that would require root-level privileges, such as moving files in /etc, installing with apt-get, and so on. I currently have: if os.geteuid() != 0: exit("You need to have root privileges to run this script.\nPlease try again, this time using 'sudo'. Exiting.") Is this the best way to do the check? Are there other best practices? 回答1: Under the "Easier to Ask Forgiveness than Permission" principle: try: os.rename('/etc/foo', '/etc/bar')

Grant privileges for a particular database in PostgreSQL

你离开我真会死。 提交于 2019-11-26 15:35:56
问题 I'm moving from MySQL to PostgreSQL and have hit a wall with user privileges. I am used to assigning a user all privileges to all tables of a database with the following command: # MySQL grant all privileges on mydatabase.* to 'myuser'@'localhost' identified by 'mypassword'; It appears to me that the PostgreSQL 9.x solution involves assigning privileges to a "schema", but the effort required of me to figure out exactly what SQL to issue is proving excessive. I know that a few more hours of

#1130 - Host ‘localhost’ is not allowed to connect to this MySQL server

我与影子孤独终老i 提交于 2019-11-26 14:38:56
问题 I issued a command of: DROP USER 'root'@'localhost'; GRANT ALL PRIVILEGES ON . TO 'root'@'%'; ...in PhpMyAdmin. Immediately after the execution, I was forced out PhpMyAdmin. I got: error #1130 - Host 'localhost' is not allowed to connect to this MySQL server, how to resolve my problem? 回答1: Use the IP instead: DROP USER 'root'@'127.0.0.1'; GRANT ALL PRIVILEGES ON . TO 'root'@'%'; For more possibilities, see this link. To create the root user, seeing as MySQL is local & all, execute the

Privileges/owner issue when writing in C:\ProgramData\

笑着哭i 提交于 2019-11-26 10:57:48
问题 As pointed out in Writing config file in C:\\Program Files (x86)\\MyApp\\myapp.cfg, vs. Administrator privilege, it is not a good idea to write a config file in C:\\Program Files (x86)\\MyApp\\myapp.cfg . Instead of this, my software now saves its data in a subdir of %ALLUSERSPROFILE% (ex : C:\\ProgramData\\MyApp\\myapp.cfg on Win7) [I use myfile = open(filename, \'a\') in Python to do this.] I now encounter an issue about this file : I installed the software with User A , and ran it, then

How can I tell if my process is running as Administrator?

喜你入骨 提交于 2019-11-26 09:44:14
问题 I would like to display some extra UI elements when the process is being run as Administrator as opposed to when it isn\'t, similar to how Visual Studio 2008 displays \'Administrator\' in its title bar when running as admin. How can I tell? 回答1: Technically, if you want to see if the member is the local administrator account , then you can get the security identifier (SID) of the current user through the User property on the WindowsIdentity class, like so (the static GetCurrent method gets

Execute Immediate within a stored procedure keeps giving insufficient priviliges error

China☆狼群 提交于 2019-11-26 09:36:48
问题 Here is the definition of the stored procedure: CREATE OR REPLACE PROCEDURE usp_dropTable(schema VARCHAR, tblToDrop VARCHAR) IS BEGIN DECLARE v_cnt NUMBER; BEGIN SELECT COUNT(*) INTO v_cnt FROM all_tables WHERE owner = schema AND table_name = tblToDrop; IF v_cnt > 0 THEN EXECUTE IMMEDIATE(\'DROP TABLE someschema.some_table PURGE\'); END IF; END; END; Here is the call: CALL usp_dropTable(\'SOMESCHEMA\', \'SOME_TABLE\'); For some reason, I keep getting insufficient privileges error for the