,[Description] = Case @ConsiderNull_Description When 0 Then IsNull(@Description, [Description]) When 1 Then @Description End
,[ApplicationData] = Case @ConsiderNull_ApplicationData When 0 Then IsNull(@ApplicationData, [ApplicationData]) When 1 Then @ApplicationData End
,[ApplyStoreSacl] = Case @ConsiderNull_ApplyStoreSacl When 0 Then IsNull(@ApplyStoreSacl, [ApplyStoreSacl]) When 1 Then @ApplyStoreSacl End
,[GenerateAudits] = Case @ConsiderNull_GenerateAudits When 0 Then IsNull(@GenerateAudits, [GenerateAudits]) When 1 Then @GenerateAudits End
,[AuthzInterfaceClsId] = Case @ConsiderNull_AuthzInterfaceClsId When 0 Then IsNull(@AuthzInterfaceClsId, [AuthzInterfaceClsId]) When 1 Then @AuthzInterfaceClsId End
,[ApplicationVersion] = Case @ConsiderNull_ApplicationVersion When 0 Then IsNull(@ApplicationVersion, [ApplicationVersion]) When 1 Then @ApplicationVersion End
Where
([ID] = @ID)
End
-- generate an audit if SACL is on
IF @SaclIsOn = 1
BEGIN
-- get info for auditing
SELECT @ObjectGuid = app.ObjectGuid FROM [dbo].[AzMan_AzApplication] app
WHERE app.ID = @ID
-- generate an audit
EXEC [AzMan_SP_GenerateGenericAudit]
@Return,
1, -- 0 for application
@Name,
@ObjectGuid,
N'The shallow properties of the application may have been modified'
[Description] = Case @ConsiderNull_Description When 0 Then IsNull(@Description, [Description]) When 1 Then @Description End
,[ApplicationData] = Case @ConsiderNull_ApplicationData When 0 Then IsNull(@ApplicationData, [ApplicationData]) When 1 Then @ApplicationData End
,[DomainTimeout] = Case @ConsiderNull_DomainTimeout When 0 Then IsNull(@DomainTimeout, [DomainTimeout]) When 1 Then @DomainTimeout End
,[ScriptEngineTimeout] = Case @ConsiderNull_ScriptEngineTimeout When 0 Then IsNull(@ScriptEngineTimeout, [ScriptEngineTimeout]) When 1 Then @ScriptEngineTimeout End
,[MaxScriptEngines] = Case @ConsiderNull_MaxScriptEngines When 0 Then IsNull(@MaxScriptEngines, [MaxScriptEngines]) When 1 Then @MaxScriptEngines End
,[TargetMachine] = Case @ConsiderNull_TargetMachine When 0 Then IsNull(@TargetMachine, [TargetMachine]) When 1 Then @TargetMachine End
,[ApplyStoreSacl] = Case @ConsiderNull_ApplyStoreSacl When 0 Then IsNull(@ApplyStoreSacl, [ApplyStoreSacl]) When 1 Then @ApplyStoreSacl End
,[GenerateAudits] = Case @ConsiderNull_GenerateAudits When 0 Then IsNull(@GenerateAudits, [GenerateAudits]) When 1 Then @GenerateAudits End
,[MajorVersion] = Case @ConsiderNull_MajorVersion When 0 Then IsNull(@MajorVersion, [MajorVersion]) When 1 Then @MajorVersion End
,[MinorVersion] = Case @ConsiderNull_MinorVersion When 0 Then IsNull(@MinorVersion, [MinorVersion]) When 1 Then @MinorVersion End
Where
([ID] = @ID)
SELECT @Error = @@ERROR, @RowCount = @@ROWCOUNT
If @RowCount <> 1
Begin
Set @Return = @Error
End
-- get info for auditing
IF @SaclIsOn = 1
BEGIN
SELECT @ObjectName=store.Name, @ObjectGuid = store.ObjectGuid FROM [dbo].[AzMan_AzAuthorizationStore] store
WHERE store.ID = @ID
-- generate an audit
EXEC [AzMan_SP_GenerateGenericAudit]
@Return,
0, -- 0 for store
@ObjectName,
@ObjectGuid,
N'The shallow properties of the store may have been modified'
END
Done:
Set NoCount Off
Return(@Return)
GO
Create Procedure [AzMan_SPU_AzScope]
-- Update an existing record in [AzMan_AzScope] table
If @ExistingBizruleID Is Null or @ExistingBizruleID = 0
Begin
Begin
Insert Into [dbo].[AzMan_BizRule]
(
[ParentId]
, [ParentType]
, [BizRuleImportedPath]
, [BizRule]
, [BizRuleLanguage]
)
Values
(
@ParentId
,@ParentType
,@BizRuleImportedPath
,@BizRule
,@BizRuleLanguage
)
SELECT @Error = @@ERROR, @RowCount = @@ROWCOUNT
If @RowCount = 1
Begin
Set @ExistingBizruleID = Cast(SCOPE_IDENTITY() As [int])
-- Update the AzApplication Groups or Task with the new ID
if @ExistingBizruleID <> 0
if @ParentType = 3 -- task
Begin
insert [dbo].[AzMan_BizRule_To_Task]
(
[TaskID] ,
[BizRuleID]
)
Values
(
@ParentID ,
@ExistingBizruleID
)
End
else if @ParentType = 5 -- group
Begin
insert [dbo].[AzMan_BizRule_To_Group]
(
[GroupID] ,
[BizRuleID]
)
Values
(
@ParentID ,
@ExistingBizruleID
)
End
End
Else
Begin
Set @Return = @Error
End
End
End
Else
Begin
If @ConsiderNull_BizRuleImportedPath Is Null
set @ConsiderNull_BizRuleImportedPath = 0
If @ConsiderNull_BizRule Is Null
set @ConsiderNull_BizRule = 0
If @ConsiderNull_BizRuleLanguage Is Null
set @ConsiderNull_BizRuleLanguage = 0
Update [dbo].[AzMan_BizRule]
Set
[ParentId] = @ParentId
, [ParentType] = @ParentType
, [BizRuleImportedPath] = Case @ConsiderNull_BizRuleImportedPath When 0 Then IsNull(@BizRuleImportedPath, [BizRuleImportedPath]) When 1 Then @BizRuleImportedPath End
, [BizRule] = Case @ConsiderNull_BizRule When 0 Then IsNull(@BizRule, [BizRule]) When 1 Then @BizRule End
, [BizRuleLanguage] = Case @ConsiderNull_BizRuleLanguage When 0 Then IsNull(@BizRuleLanguage, [BizRuleLanguage]) When 1 Then @BizRuleLanguage End