Options

Bug on Find Invalid Objects

DanAvniDanAvni Posts: 72 Bronze 2
edited August 22, 2014 8:44AM in SQL Prompt
I have the function below on a DB. the table ObjectPermissions does not exist anymore but the function does not list as an invalid object

ALTER FUNCTION [dbo].[CheckEnforceGroupPermissionsForEmployeeGUID]
(
@EmployeeGUID uniqueidentifier,
@EnforceGroupPermissionsForUserGuid uniqueidentifier
)
RETURNS bit
AS BEGIN
DECLARE @RetVal as bit
IF @EnforceGroupPermissionsForUserGuid is null
BEGIN
SET @RetVal = 1
end
ELSE
begin --running against a specific user
declare @GroupGUID uniqueidentifier
select @GroupGUID = GroupGuid
From Employees
Where Employees.Guid = @EmployeeGUID
if @GroupGUID is null
begin --no group for employee
SET @RetVal = 0
end
else
begin --employee has a group
if exists ( Select *
From ObjectPermissions
where ObjectGuid = @GroupGUID AND
UserGuid = @EnforceGroupPermissionsForUserGuid AND
ObjectType = 0 )
begin
SET @RetVal = 1
end
else
begin
SET @RetVal = 0
end
end
end
RETURN @RetVal

END
Dan Avni

Comments

  • Options
    Aaron LAaron L Posts: 596 New member
    Hi Dan,

    Thanks for your post, I can recreate this here and will look into seeing what we can do about fixing it.

    Thanks,
    Aaron.
  • Options
    Aaron LAaron L Posts: 596 New member
    Hi Dan,

    We think we've got a fix for you, could you please give this private build a try and let us know if the function is correctly detected as invalid?

    Thanks,
    Aaron.
Sign In or Register to comment.