Compartilhar via


Classe User

The User object represents a SQL Server user.

Namespace:  Microsoft.SqlServer.Management.Smo
Assembly:  Microsoft.SqlServer.Smo (em Microsoft.SqlServer.Smo.dll)

Sintaxe

'Declaração
<EvaluationModeAttribute(AutomatedPolicyEvaluationMode.None Or AutomatedPolicyEvaluationMode.Enforce Or AutomatedPolicyEvaluationMode.CheckOnChanges Or AutomatedPolicyEvaluationMode.CheckOnSchedule)> _
<StateChangeEventAttribute("CREATE_USER", "USER", "GROUP USER")> _
<StateChangeEventAttribute("CREATE_USER", "USER", "SQL USER")> _
<StateChangeEventAttribute("ALTER_USER", "USER", "SQL USER")> _
<StateChangeEventAttribute("CREATE_USER", "USER", "WINDOWS USER")> _
<StateChangeEventAttribute("ALTER_USER", "USER", "WINDOWS USER")> _
<StateChangeEventAttribute("ALTER_USER", "USER", "CERTIFICATE USER")> _
<PhysicalFacetAttribute> _
<StateChangeEventAttribute("CREATE_USER", "USER", "CERTIFICATE USER")> _
<StateChangeEventAttribute("ALTER_USER", "USER", "GROUP USER")> _
<StateChangeEventAttribute("CREATE_USER", "USER", "ASYMMETRIC KEY USER")> _
<StateChangeEventAttribute("ALTER_USER", "USER", "ASYMMETRIC KEY USER")> _
Public NotInheritable Class User _
    Inherits ScriptNameObjectBase _
    Implements IObjectPermission, ICreatable, IDroppable, IAlterable,  _
    IRenamable, IExtendedProperties, IScriptable
'Uso
Dim instance As User
[EvaluationModeAttribute(AutomatedPolicyEvaluationMode.None|AutomatedPolicyEvaluationMode.Enforce|AutomatedPolicyEvaluationMode.CheckOnChanges|AutomatedPolicyEvaluationMode.CheckOnSchedule)]
[StateChangeEventAttribute("CREATE_USER", "USER", "GROUP USER")]
[StateChangeEventAttribute("CREATE_USER", "USER", "SQL USER")]
[StateChangeEventAttribute("ALTER_USER", "USER", "SQL USER")]
[StateChangeEventAttribute("CREATE_USER", "USER", "WINDOWS USER")]
[StateChangeEventAttribute("ALTER_USER", "USER", "WINDOWS USER")]
[StateChangeEventAttribute("ALTER_USER", "USER", "CERTIFICATE USER")]
[PhysicalFacetAttribute]
[StateChangeEventAttribute("CREATE_USER", "USER", "CERTIFICATE USER")]
[StateChangeEventAttribute("ALTER_USER", "USER", "GROUP USER")]
[StateChangeEventAttribute("CREATE_USER", "USER", "ASYMMETRIC KEY USER")]
[StateChangeEventAttribute("ALTER_USER", "USER", "ASYMMETRIC KEY USER")]
public sealed class User : ScriptNameObjectBase, IObjectPermission, 
    ICreatable, IDroppable, IAlterable, IRenamable, IExtendedProperties, 
    IScriptable
[EvaluationModeAttribute(AutomatedPolicyEvaluationMode::None|AutomatedPolicyEvaluationMode::Enforce|AutomatedPolicyEvaluationMode::CheckOnChanges|AutomatedPolicyEvaluationMode::CheckOnSchedule)]
[StateChangeEventAttribute(L"CREATE_USER", L"USER", L"GROUP USER")]
[StateChangeEventAttribute(L"CREATE_USER", L"USER", L"SQL USER")]
[StateChangeEventAttribute(L"ALTER_USER", L"USER", L"SQL USER")]
[StateChangeEventAttribute(L"CREATE_USER", L"USER", L"WINDOWS USER")]
[StateChangeEventAttribute(L"ALTER_USER", L"USER", L"WINDOWS USER")]
[StateChangeEventAttribute(L"ALTER_USER", L"USER", L"CERTIFICATE USER")]
[PhysicalFacetAttribute]
[StateChangeEventAttribute(L"CREATE_USER", L"USER", L"CERTIFICATE USER")]
[StateChangeEventAttribute(L"ALTER_USER", L"USER", L"GROUP USER")]
[StateChangeEventAttribute(L"CREATE_USER", L"USER", L"ASYMMETRIC KEY USER")]
[StateChangeEventAttribute(L"ALTER_USER", L"USER", L"ASYMMETRIC KEY USER")]
public ref class User sealed : public ScriptNameObjectBase, 
    IObjectPermission, ICreatable, IDroppable, IAlterable, IRenamable, 
    IExtendedProperties, IScriptable
[<SealedAttribute>]
[<EvaluationModeAttribute(AutomatedPolicyEvaluationMode.None|AutomatedPolicyEvaluationMode.Enforce|AutomatedPolicyEvaluationMode.CheckOnChanges|AutomatedPolicyEvaluationMode.CheckOnSchedule)>]
[<StateChangeEventAttribute("CREATE_USER", "USER", "GROUP USER")>]
[<StateChangeEventAttribute("CREATE_USER", "USER", "SQL USER")>]
[<StateChangeEventAttribute("ALTER_USER", "USER", "SQL USER")>]
[<StateChangeEventAttribute("CREATE_USER", "USER", "WINDOWS USER")>]
[<StateChangeEventAttribute("ALTER_USER", "USER", "WINDOWS USER")>]
[<StateChangeEventAttribute("ALTER_USER", "USER", "CERTIFICATE USER")>]
[<PhysicalFacetAttribute>]
[<StateChangeEventAttribute("CREATE_USER", "USER", "CERTIFICATE USER")>]
[<StateChangeEventAttribute("ALTER_USER", "USER", "GROUP USER")>]
[<StateChangeEventAttribute("CREATE_USER", "USER", "ASYMMETRIC KEY USER")>]
[<StateChangeEventAttribute("ALTER_USER", "USER", "ASYMMETRIC KEY USER")>]
type User =  
    class
        inherit ScriptNameObjectBase
        interface IObjectPermission
        interface ICreatable
        interface IDroppable
        interface IAlterable
        interface IRenamable
        interface IExtendedProperties
        interface IScriptable
    end
public final class User extends ScriptNameObjectBase implements IObjectPermission, ICreatable, IDroppable, IAlterable, IRenamable, IExtendedProperties, IScriptable

Comentários

To get User object properties, users can be a member of the public fixed server role.

To set User object properties, uses must have ALTE ANY USER permission on the database or be a member of the db_owner fixed database role.

To change the default schema, users must have ALTER permission on the specified user or be the owner of the user.

To create or drop a user, users must have ALTER ANY USER permission on the fixed server role or be a member of the db_owner fixed database role.

To grant, deny, or revoke permission on the specified user to other users, users must have CONTROL permission on the specified user.

Thread Safety

Qualquer membro público estático (Compartilhado no Microsoft Visual Basic) desse tipo é seguro para operações multi-threaded. Não há garantia de que qualquer membro de instância seja seguro para threads.

Segurança de thread

Quaisquer membros static (Shared no Visual Basic) públicos deste tipo são thread-safe. Não há garantia de que qualquer membro de instância seja thread-safe.