⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 policy_add.sql

📁 Java写的ERP系统
💻 SQL
字号:
/*************************************************************************
 * The contents of this file are subject to the Compiere License.  You may
 * obtain a copy of the License at    http://www.compiere.org/license.html
 * Software is on an  "AS IS" basis,  WITHOUT WARRANTY OF ANY KIND, either
 * express or implied. See the License for details. Code: Compiere ERP+CPM
 * Copyright (C) 1999-2001 Jorg Janke, ComPiere, Inc. All Rights Reserved.
 *************************************************************************
 * $Id: Policy_Add.sql,v 1.3 2002/10/21 04:49:45 jjanke Exp $
 ***
 * Title:		Create Policies	 
 * Description:
 ************************************************************************/
DECLARE
	CURSOR	Cur_Tables	IS
		SELECT 	TableName 
		FROM 	AD_Table
		  --	General accessible tables
		WHERE 	TableName NOT LIKE 'RV%' 	--	Report Views
		  AND	TableName NOT LIKE 'T%' 	--	Temporary
		  --	Login Tables
		  AND	TableName NOT IN ('AD_User', 'AD_User_Roles', 'AD_Role', 'AD_Client', 'AD_Org', 'M_Warehouse')
		  --	Non Standard Tables
		  AND	TableName NOT LIKE 'AD_PInstance%'
		  AND	TableName NOT IN ('AD_Find')
		ORDER BY TableName;
BEGIN
	DBMS_OUTPUT.PUT_LINE('Loging in ...');
	Compiere_Context.Login('SuperUser','System','System Administrator');
--  Compiere_Context.Login('Compiere','Internal','Server');
	--
	DBMS_OUTPUT.PUT_LINE('Creating Policies ...');
    FOR t IN Cur_Tables LOOP
		BEGIN
			DBMS_OUTPUT.PUT(t.TableName);
			DBMS_RLS.ADD_POLICY (
				'Compiere',					--	object_schema
				t.TableName,				--  object_name
				t.TableName || '_Pol',		--	policy_name
				'Compiere',					--	function_schema
				'Compiere_Context.GetPredicate',	--	policy_function
				NULL,						--	statement_types 'SELECT,INSERT,UPDATE,DELETE'
				TRUE,						--	update_check
				TRUE);						--	enable          
			DBMS_OUTPUT.PUT_LINE(' ok');
			EXCEPTION
				WHEN OTHERS THEN
					DBMS_OUTPUT.PUT_LINE(' *** error ***');
		END;
	END LOOP;
END;
/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -