Added stored procedure vesp_ResetSecurity

This commit is contained in:
Rich 2013-11-25 04:41:16 +00:00
parent c39cca8eef
commit d7da2e454d

View File

@ -7120,7 +7120,6 @@ WITH EXECUTE AS OWNER
AS
SELECT
[RoUsages].[ROUsageID],
[RoUsages].[ContentID],
[RoUsages].[ROID],
[RoUsages].[Config],
[RoUsages].[DTS],
@ -7131,7 +7130,6 @@ AS
[Contents].[Text] [Content_Text],
[Contents].[Type] [Content_Type],
[Contents].[FormatID] [Content_FormatID],
[Contents].[Config] [Content_Config],
[Contents].[DTS] [Content_DTS],
[Contents].[UserID] [Content_UserID]
FROM [RoUsages]
@ -8265,3 +8263,38 @@ else begin
print ''MultiUser and Security Exists'''
end
GO
--added jcb 1st round fixes multiuser and security testting
--ALTER TABLE Groups change GroupName column to 100 characters
ALTER TABLE groups ALTER COLUMN [GroupName] [nvarchar](100) NOT NULL
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vesp_ResetSecurity]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
DROP PROCEDURE [vesp_ResetSecurity];
GO
/*****************************************************************************
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
Copyright 2012 - Volian Enterprises, Inc. All rights reserved.
*****************************************************************************/
CREATE PROCEDURE [dbo].[vesp_ResetSecurity]
AS
BEGIN
DELETE FROM [Memberships]
DELETE FROM [Assignments] WHERE [AID] != 1
DELETE FROM [Groups] WHERE [GID] != 1
DELETE FROM [Users]
DECLARE @gid VARCHAR(10)
SELECT @gid = x1.value('@Group','varchar(10)')
FROM
(
SELECT folderid,CAST(config as xml) xconfig FROM folders ff WHERE ff.folderid = 1
) ah
CROSS APPLY xconfig.nodes('//Security') t1(x1)
UPDATE folders SET config = replace(config,'Security Group="' + @gid + '"','Security Group="1"') WHERE folderid = 1
END
GO
-- Display the status of Proc creation
IF (@@Error = 0) PRINT 'Procedure Creation: vesp_ResetSecurity Succeeded'
ELSE PRINT 'Procedure Creation: vesp_ResetSecurity Error on Creation'
GO