Stored Procedures [dbo].[ols_sp_setObjectOwner]
Properties
PropertyValue
ANSI Nulls OnYes
Quoted Identifier OnYes
Parameters
NameData TypeMax Length (Bytes)
@_urinvarchar(255)510
@_obj_uuidbinary(16)16
Permissions
TypeActionOwning Principal
GrantExecuteca_itrm_group
GrantExecuteca_itrm_group_ams
SQL Script
/**
******************************************************
* set a link object owner for a ceration user
*
* @param @_uri URI of the creation user
*
* @param @_obj_uuid uuid of the created object
*/


CREATE procedure ols_sp_setObjectOwner
(    @_uri        nvarchar(255),
    @_obj_uuid    binary(16)
)
as
begin
    declare @_owner_profile_uuid binary(16);
    declare @_user_uuid            binary(16);

    set nocount on;
    if ( @_uri is null )
    begin
        return 0;
    end;


    /* get the owner profile uuid */
    select @_owner_profile_uuid = (select security_profile_uuid
                                  from ca_security_profile
                                          where type = 0);

    if( @_owner_profile_uuid is null)
    begin
        return 0;
    end;

    /* get the user uuid  - normally we get only one*/
    declare cur_user cursor for select user_uuid
                                from ca_discovered_user
                                where uri = @_uri and (user_type = 1 or user_type = 2)
    open cur_user;
    fetch from cur_user into @_user_uuid; -- get first

    while @@fetch_status = 0
    begin
        -- create object owner
        insert into ca_link_object_owner (object_uuid, owner_uuid, security_profile_uuid, version_number)
                values ( @_obj_uuid, @_user_uuid, @_owner_profile_uuid,  0 );


        break;
    end;
    close cur_user;
    deallocate cur_user;
end;
GO
GRANT EXECUTE ON  [dbo].[ols_sp_setObjectOwner] TO [ca_itrm_group]
GRANT EXECUTE ON  [dbo].[ols_sp_setObjectOwner] TO [ca_itrm_group_ams]
GO
Uses
Used By