malaqui
-
5/18/2006 8:10:31 PM
Established permissions in new page created
Hi, We need to assing permissions to new pages in the creation time. We try to modify the insert query in this way
INSERT INTO [Sybarite_FirmaLuxury] ( [ImagenCuadro1], [TextoCuadro1], [TextoCuadro2], [ImagenCuadro3], [TextoCuadro4], [Nombre], [Url], [Telefono] ) VALUES ( @ImagenCuadro1, @TextoCuadro1, @TextoCuadro2, @ImagenCuadro3, @TextoCuadro4, @Nombre, @Url, @Telefono); SELECT @@identity AS [FirmaLuxuryID];
declare @id int
/* para obtener el id del objeto firma luxury creado */ select @id = MAX(FirmaLuxuryID) from Sybarite_FirmaLuxury
print('identificador') print(@id)
declare @user int declare @acl int
/* para obtener el acl y el usuario del objeto firma luxury creado */ select @acl = ACLID , @user = CreatedBYUserID from cms_tree where classID=22 and ForeignKeyValue = @id
print('acl') print(@acl) print('usuario') print(@user) /* para que el usuario que ha creado el objeto firma tenga todos los permisos sobre él */ /*insert into CMS_ACLItem values (@acl,@user,null,0,127,'2006/05/18 00:00:00',@user)*/ if @acl <> null begin insert into CMS_ACLItem values (@acl,@user,null,0,127,getdate(),@user)
/* para quitar a cada objeto que el resto de usuarios */
DECLARE MyCursor CURSOR FOR select distinct(aclid), createdByUserID from cms_tree where classID=22 and createdByUserID <> @user
OPEN MyCursor
DECLARE @aclid2 int DECLARE @user2 int
FETCH NEXT FROM MyCursor INTO @aclid2, @user2 WHILE @@FETCH_STATUS = 0 BEGIN
print('aclid2') print(@aclid2) print('user2') print(@user2)
declare @cuantos int select @cuantos = COUNT(*) from CMS_ACLItem where aclid = @aclid2 and userid = @user2 print('cuantos') print(@cuantos)
if @cuantos = 0 begin insert into CMS_ACLItem values (@aclid2,@user2,null,127,0,getdate(),@user2) end FETCH NEXT FROM MyCursor INTO @aclid2, @user2 END
CLOSE MyCursor DEALLOCATE MyCursor
end
But we can't recover ACLId, because it is not yet created. Where is the error? Regards
|