SqlUser Element (ADF)
Specifies the name of the database user used to run the condition action.
語法
<ConditionAction>
...
<SqlUser>
Element Characteristics
Characteristic | Description |
---|---|
Data type |
string. |
Default value |
None. |
Occurrence |
Required once per ConditionAction element. |
Updates |
You can modify this element, but cannot add or delete it when updating the application. You can add and delete the parent ConditionAction element. |
Element Relationships
Relationship | Elements |
---|---|
Parent element |
|
Child elements |
None. |
備註
All condition actions execute in the context of a database user that you specify for the condition action. Using a low-privileged user minimizes the security threat in case anyone compromises your subscription management interface and inserts conditions that attempt to access other tables or perform other actions.
Specify the database user in the SqlUser element. Notification Services creates the user account; it cannot exist before you create the application.
Make sure the database user, and its associated Microsoft SQL Server Login, which is named in the SqlLogin element, has restricted permissions in the database. Also make sure the user and the associated SqlLogin are not likely to be removed from the server or the domain while the application is deployed, as this will cause application errors.
Notification Services grants the necessary permissions on Notification Services objects, but does not grant permissions on the input tables or views, nor does it grant permissions on any user-defined functions that are used by condition actions. You will need to grant these permissions when deploying the application. For more information about granting these permissions, see 定義條件動作.
範例
The following example shows how to define a condition action. The query in the Transact-SQL expression selects data from the MyAppSchema.WeatherEventRule view, which contains data from the subscription class and from the MyAppSchema.WeatherEvents event view.
<ConditionAction>
<SqlLogin>[MyLowPrivLogin]</SqlLogin>
<SqlUser>[MyLowPrivUser]</SqlUser>
<InputName>WeatherEvents</InputName>
<InputSchema>MyAppSchema</InputSchema>
<SqlExpression>
INSERT INTO MyAppSchema.WeatherNotifications(SubscriberId,
DeviceName, SubscriberLocale, City, Forecast)
SELECT [Subscription.SubscriberId], [Subscription.DeviceName],
[Subscription.SubscriberLocale], [Input.City],
[Input.Forecast])
FROM MyAppSchema.WeatherEventRule;
</SqlExpression>
</ConditionAction>
請參閱
參考
SqlLogin Element (ADF)
Application Definition File Reference
概念
Instance Configuration File Reference