Freigeben über


User-Klasse

The User object represents a SQL Server user.

Vererbungshierarchie

System.Object
  Microsoft.SqlServer.Management.Smo.SmoObjectBase
    Microsoft.SqlServer.Management.Smo.SqlSmoObject
      Microsoft.SqlServer.Management.Smo.NamedSmoObject
        Microsoft.SqlServer.Management.Smo.ScriptNameObjectBase
          Microsoft.SqlServer.Management.Smo.User

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

Syntax

'Declaration
<PhysicalFacetAttribute> _
<EvaluationModeAttribute(AutomatedPolicyEvaluationMode.CheckOnSchedule)> _
Public NotInheritable Class User _
    Inherits ScriptNameObjectBase _
    Implements ISfcSupportsDesignMode, IObjectPermission, ICreatable, IDroppable,  _
    IAlterable, IRenamable, IExtendedProperties, IScriptable, IUserOptions,  _
    IDmfFacet
'Usage
Dim instance As User
[PhysicalFacetAttribute]
[EvaluationModeAttribute(AutomatedPolicyEvaluationMode.CheckOnSchedule)]
public sealed class User : ScriptNameObjectBase, ISfcSupportsDesignMode, 
    IObjectPermission, ICreatable, IDroppable, IAlterable, IRenamable, 
    IExtendedProperties, IScriptable, IUserOptions, IDmfFacet
[PhysicalFacetAttribute]
[EvaluationModeAttribute(AutomatedPolicyEvaluationMode::CheckOnSchedule)]
public ref class User sealed : public ScriptNameObjectBase, 
    ISfcSupportsDesignMode, IObjectPermission, ICreatable, IDroppable, IAlterable, 
    IRenamable, IExtendedProperties, IScriptable, IUserOptions, IDmfFacet
[<SealedAttribute>]
[<PhysicalFacetAttribute>]
[<EvaluationModeAttribute(AutomatedPolicyEvaluationMode.CheckOnSchedule)>]
type User =  
    class 
        inherit ScriptNameObjectBase 
        interface ISfcSupportsDesignMode 
        interface IObjectPermission 
        interface ICreatable 
        interface IDroppable 
        interface IAlterable 
        interface IRenamable 
        interface IExtendedProperties 
        interface IScriptable 
        interface IUserOptions 
        interface IDmfFacet 
    end
public final class User extends ScriptNameObjectBase implements ISfcSupportsDesignMode, IObjectPermission, ICreatable, IDroppable, IAlterable, IRenamable, IExtendedProperties, IScriptable, IUserOptions, IDmfFacet

Der User-Typ macht folgende Elemente verfügbar.

Konstruktoren

  Name Beschreibung
Öffentliche Methode User() Initializes a new instance of the User class.
Öffentliche Methode User(Database, String) Initializes a new instance of the User class on the specified database with the specified name.

Zum Anfang

Eigenschaften

  Name Beschreibung
Öffentliche Eigenschaft AsymmetricKey Gets or sets the asymmetric key for the user.
Öffentliche Eigenschaft AuthenticationType Gets a string value that describes the mechanism used to authenticate the user.
Öffentliche Eigenschaft Certificate Gets or sets the certificate for the user.
Öffentliche Eigenschaft CreateDate Gets the date and time when the database user was created.
Öffentliche Eigenschaft DateLastModified Gets the date and time when the database user was last modified.
Öffentliche Eigenschaft DefaultLanguage Gets or sets the default language for the user.
Öffentliche Eigenschaft DefaultSchema Gets the default schema for the database user.
Öffentliche Eigenschaft Events Gets the events that are associated with the database user.
Öffentliche Eigenschaft ExtendedProperties Gets the extended properties of the database user.
Öffentliche Eigenschaft HasDBAccess Gets the Boolean property that specifies whether the database user has access to the database.
Öffentliche Eigenschaft ID Gets the ID value that uniquely identifies the database user.
Öffentliche Eigenschaft IsSystemObject Gets the Boolean property that specifies whether the database user is a system object.
Öffentliche Eigenschaft Login Gets the login that is associated with the database user.
Öffentliche Eigenschaft LoginType Gets the type of login that is associated with the database user, such as whether it is a Windows group or a SQL Server standard login.
Öffentliche Eigenschaft Name Gets or sets a String value that specifies the name of the user. (Überschreibt NamedSmoObject.Name.)
Öffentliche Eigenschaft Parent Gets the Database object that is the parent of the User object.
Öffentliche Eigenschaft Properties Gets a collection of Property objects that represent the object properties. (Geerbt von SqlSmoObject.)
Öffentliche Eigenschaft Sid Gets the security identification number (SID) value of the database user.
Öffentliche Eigenschaft State Gets the state of the referenced object. (Geerbt von SmoObjectBase.)
Öffentliche Eigenschaft Urn Gets the Uniform Resource Name (URN) address value that uniquely identifies the object. (Geerbt von SqlSmoObject.)
Öffentliche Eigenschaft UserData Gets or sets user-defined data associated with the referenced object. (Geerbt von SmoObjectBase.)
Öffentliche Eigenschaft UserType Gets or sets the type of user.

Zum Anfang

Methoden

  Name Beschreibung
Öffentliche Methode AddToRole Adds the database user to the specified role.
Öffentliche Methode Alter Updates any User object property changes on the instance of Microsoft SQL Server. 
Öffentliche Methode ChangePassword(SecureString) Changes the user password.
Öffentliche Methode ChangePassword(String) Changes the user password.
Öffentliche Methode ChangePassword(SecureString, SecureString) Changes the user password.
Öffentliche Methode ChangePassword(String, String) Changes the user password.
Öffentliche Methode Create() Creates a database user on the instance of SQL Server as defined by the User object.
Öffentliche Methode Create(SecureString) Creates a database user on the instance of SQL Server as defined by the User object with specified password using a secure string.
Öffentliche Methode Create(String) Creates a database user on the instance of SQL Server as defined by the User object with specified password.
Öffentliche Methode Deny(ObjectPermissionSet, String) Denies access to the specified permission for the specified grantee on the database user.
Öffentliche Methode Deny(ObjectPermissionSet, array<String[]) Denies access to the specified permission for the specified grantees on the database user.
Öffentliche Methode Deny(ObjectPermissionSet, String, Boolean) Denies access to the specified permission for the specified grantee and other users whom the grantee granted access on the database user.
Öffentliche Methode Deny(ObjectPermissionSet, array<String[], Boolean) Denies access to the specified permission for the specified grantees on the database user.
Öffentliche Methode Discover Discovers a list of type Object. (Geerbt von SqlSmoObject.)
Öffentliche Methode Drop Removes the user from the database.
Öffentliche Methode EnumObjectPermissions() Enumerates a list of object permissions for the database user.
Öffentliche Methode EnumObjectPermissions(String) Enumerates a list of object permissions for a specified grantee on the database user.
Öffentliche Methode EnumObjectPermissions(ObjectPermissionSet) Enumerates a list of object permissions for a specified permission on the database user.
Öffentliche Methode EnumObjectPermissions(String, ObjectPermissionSet) Enumerates a list of object permissions for a specified grantee and a specified permission on the database user.
Öffentliche Methode EnumOwnedObjects Enumerates a list of object that the database user owns.
Öffentliche Methode EnumRoles Enumerates a list of roles of which the database user is a member.
Öffentliche Methode Equals (Geerbt von Object.)
Geschützte Methode FormatSqlVariant Formats an object as SqlVariant type. (Geerbt von SqlSmoObject.)
Geschützte Methode GetContextDB Gets the context database that is associated with this object. (Geerbt von SqlSmoObject.)
Geschützte Methode GetDBName Gets the database name that is associated with the object. (Geerbt von SqlSmoObject.)
Öffentliche Methode GetHashCode (Geerbt von Object.)
Geschützte Methode GetPropValue Gets a property value of the SqlSmoObject object. (Geerbt von SqlSmoObject.)
Geschützte Methode GetPropValueOptional Gets a property value of the SqlSmoObject object. (Geerbt von SqlSmoObject.)
Geschützte Methode GetPropValueOptionalAllowNull Gets a property value of the SqlSmoObject object. (Geerbt von SqlSmoObject.)
Geschützte Methode GetServerObject Gets the server of the SqlSmoObject object. (Geerbt von SqlSmoObject.)
Öffentliche Methode GetType (Geerbt von Object.)
Öffentliche Methode Grant(ObjectPermissionSet, String) Grants access to the specified permission for the specified grantee on the database user.
Öffentliche Methode Grant(ObjectPermissionSet, array<String[]) Grants access to the specified permission for the specified grantees on the database user.
Öffentliche Methode Grant(ObjectPermissionSet, String, Boolean) Grants access to the specified permission and the ability to grant access to other users for the specified grantee on the database user.
Öffentliche Methode Grant(ObjectPermissionSet, array<String[], Boolean) Grants access to the specified permission and the ability to grant access to other users for the specified grantees on the database user.
Öffentliche Methode Grant(ObjectPermissionSet, String, Boolean, String) Grants access to the specified permission and the ability to grant access to other users for the specified grantee on the database user.
Öffentliche Methode Grant(ObjectPermissionSet, array<String[], Boolean, String) Grants access to the specified permission and the ability to grant access to other users for the specified grantee on the database user under an assumed role.
Öffentliche Methode Initialize() Initializes the object and forces the properties be loaded. (Geerbt von SqlSmoObject.)
Öffentliche Methode Initialize(Boolean) Initializes the object and forces the properties be loaded. (Geerbt von SqlSmoObject.)
Öffentliche Methode IsMember Verifies whether the database user is a member of the specified role.
Geschützte Methode IsObjectInitialized Verifies whether the object has been initialized. (Geerbt von SqlSmoObject.)
Geschützte Methode IsObjectInSpace Verifies whether the object is isolated or connected to the instance of SQL Server. (Geerbt von SqlSmoObject.)
Öffentliche Methode MakeContained Converts a login mapped user to a contained user with password using the sys.sp_copy_password_to_user stored procedure.
Öffentliche Methode Refresh Refreshes the script name. (Geerbt von ScriptNameObjectBase.)
Öffentliche Methode Rename Renames the database user.
Öffentliche Methode Revoke(ObjectPermissionSet, String) Revokes previously granted permissions from a grantee on the database user.
Öffentliche Methode Revoke(ObjectPermissionSet, array<String[]) Revokes previously granted permissions from a list of grantees on the database user.
Öffentliche Methode Revoke(ObjectPermissionSet, String, Boolean, Boolean) Revokes previously granted permissions from a grantee on the database user and any other users to whom the grantee has granted access. The grantee is also given the ability to revoke other users' access.
Öffentliche Methode Revoke(ObjectPermissionSet, array<String[], Boolean, Boolean) Revokes previously granted permissions from the grantees on the database user and any other users to whom the grantees have granted access. The grantees are also given the ability to revoke other users' access.
Öffentliche Methode Revoke(ObjectPermissionSet, String, Boolean, Boolean, String) Revokes previously granted permissions from a grantee on the database user and any other users to whom the grantee has granted access. The grantee is also given the ability to revoke other users' access under an assumed role.
Öffentliche Methode Revoke(ObjectPermissionSet, array<String[], Boolean, Boolean, String) Revokes previously granted permissions from grantees on the database user and any other users to whom the grantees have granted access. The grantees are also given the ability to revoke other users' access under an assumed role.
Öffentliche Methode Script() Generates a Transact-SQL script that can be used to re-create the database user.
Öffentliche Methode Script(ScriptingOptions) Generates a Transact-SQL script that can be used to re-create the database user as specified by the script options.
Geschützte Methode SetParentImpl Sets the parent of the SqlSmoObject to the newParent parameter. (Geerbt von SqlSmoObject.)
Öffentliche Methode ToString Returns a String that represents the referenced object. (Geerbt von SqlSmoObject.)
Öffentliche Methode Validate Validates the state of an object. (Geerbt von SmoObjectBase.)

Zum Anfang

Ereignisse

  Name Beschreibung
Öffentliches Ereignis PropertyChanged Represents the event that occurs when a property is changed. (Geerbt von SqlSmoObject.)
Öffentliches Ereignis PropertyMetadataChanged Represents the event that occurs when property metadata changes. (Geerbt von SqlSmoObject.)

Zum Anfang

Explizite Schnittstellenimplementierungen

  Name Beschreibung
Explizite SchnittstellenimplementierungPrivate Methode IAlienObject.Discover Discovers any dependencies. Verweisen Sie nicht direkt im Code auf dieses Element. Unterstützt die SQL Server-Infrastruktur. (Geerbt von SqlSmoObject.)
Explizite SchnittstellenimplementierungPrivate Methode IAlienObject.GetDomainRoot Returns the root of the domain. (Geerbt von SqlSmoObject.)
Explizite SchnittstellenimplementierungPrivate Methode IAlienObject.GetParent Gets the parent of this object. Verweisen Sie nicht direkt im Code auf dieses Element. Unterstützt die SQL Server-Infrastruktur. (Geerbt von SqlSmoObject.)
Explizite SchnittstellenimplementierungPrivate Methode IAlienObject.GetPropertyType Gets the type of the specified property. (Geerbt von SqlSmoObject.)
Explizite SchnittstellenimplementierungPrivate Methode IAlienObject.GetPropertyValue Gets the value of the specified property. (Geerbt von SqlSmoObject.)
Explizite SchnittstellenimplementierungPrivate Methode IAlienObject.GetUrn Gets the Unified Resource Name (URN) of the object. Verweisen Sie nicht direkt im Code auf dieses Element. Unterstützt die SQL Server-Infrastruktur. (Geerbt von SqlSmoObject.)
Explizite SchnittstellenimplementierungPrivate Methode IAlienObject.Resolve Gets the instance that contains the information about the object from the Unified Resource Name (URN) of the object. (Geerbt von SqlSmoObject.)
Explizite SchnittstellenimplementierungPrivate Methode IAlienObject.SetObjectState Sets the object state to the specified SfcObjectState value. (Geerbt von SqlSmoObject.)
Explizite SchnittstellenimplementierungPrivate Methode IAlienObject.SetPropertyValue Sets the property value. (Geerbt von SqlSmoObject.)
Explizite SchnittstellenimplementierungPrivate Methode ISfcPropertyProvider.GetPropertySet Gets the interface reference to the set of properties of this object. (Geerbt von SqlSmoObject.)
Explizite SchnittstellenimplementierungPrivate Eigenschaft ISfcSupportsDesignMode.IsDesignMode Gets a Boolean value that specifies whether the user supports design mode.

Zum Anfang

Hinweise

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

To set User object properties, uses must have ALTER 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

Alle öffentlichen, statischen Elemente dieses Typs (Shared in Microsoft Visual Basic) sind für Vorgänge mit mehreren Threads sicher. Bei Instanzmembern ist die Threadsicherheit nicht gewährleistet.

Beispiele

Verwalten von Benutzern, Rollen und Anmeldungen

Threadsicherheit

Alle öffentlichen static (Shared in Visual Basic)-Elemente dieses Typs sind Threadsicher. Für Instanzelemente wird die Threadsicherheit nicht gewährleistet.

Siehe auch

Verweis

Microsoft.SqlServer.Management.Smo-Namespace

Andere Ressourcen

CREATE USER (Transact-SQL)