Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Grupo-Usuario

32 views
Skip to first unread message

Maribel Oliver

unread,
Feb 9, 2001, 6:33:26 PM2/9/01
to
Cómo puedo determinar a qué grupo pertenece un usuario. Estoy utilizando
la seguridad de NT.

Gracias

Fernando G. Guerrero

unread,
Feb 9, 2001, 5:58:49 PM2/9/01
to
Puedes utilizar este script para crear un procedimiento del sistema que te
devueve los grupos de NT a los que un login pertenece:

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS OFF
GO

exec sp_configure 'allow updates', 1
reconfigure with override
go

exec sp_ms_upd_sysobj_category 1
go

checkpoint
go

CREATE PROC xp_GetNTGroups
@acctname sysname = null -- IN: NT login name
as
IF @acctname is NULL
SET @acctname = suser_sname()
select distinct nt.domain+N'\'+nt.name AS NTGroup
from OpenRowset(NetUserGetGroups, @acctname) AS NT
JOIN master.dbo.sysxlogins s
ON s.sid = NT.sid

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

EXEC xp_getntgroups


--
Fernando G. Guerrero
QA Group Ltd., UK
PASS Spanish Group

"Share what you know, learn what you don't"


"Maribel Oliver" <rod...@ayayai.com> wrote in message
news:OZH8$hukAHA.464@tkmsftngp02...

Maribel Oliver

unread,
Feb 10, 2001, 9:34:10 AM2/10/01
to
Gracias.


Maribel Oliver

unread,
Feb 10, 2001, 2:08:46 PM2/10/01
to
Disculpa, pero se pueden obtener los usuarios que pertenecen a determinado
grupo.


Fernando G. Guerrero

unread,
Feb 11, 2001, 5:04:06 AM2/11/01
to
Aquí tienes el script que crea la función que necesitas (funciona en SQL7 y
SQL 2000):

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS OFF
GO

exec sp_configure 'allow updates', 1
reconfigure with override
go

exec sp_ms_upd_sysobj_category 1
go

checkpoint
go

CREATE PROC xp_GetNTGroupMembers
@acctname sysname --IN: NT group name
as
select Name
from OpenRowset(NetGroupGetMembers, @acctname) AS NT

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

-- Para probarla:

EXEC xp_getntgroupmembers 'BUILTIN\Administrators'

--
Fernando G. Guerrero
QA Group Ltd., UK
PASS Spanish Group

"Share what you know, learn what you don't"


"Maribel Oliver" <rod...@ayayai.com> wrote in message

news:OX4Fxy4kAHA.1932@tkmsftngp05...

Maribel Oliver

unread,
Feb 12, 2001, 9:43:05 AM2/12/01
to
Gracias las dos funciones que me proporcionaste me son de gran utilidad.


0 new messages