Ownership Based Editing Online

This sample demonstrates the ability of feature services to restrict editing operations based on feature ownership. The owner is defined as the user who created the feature. In this example, owners can update or delete their features. Feature not owned by the current user cannot be updated or deleted.

The following credentials are valid user accounts for the sample service:

user1\user1

user2\user2

user3\user3

Download Sample Application
XAML C# VB.NET
<UserControl x:Class="ArcGISWPFSDK.OwnershipBasedEditing"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:esri="http://schemas.esri.com/arcgis/client/2009">
    <Grid x:Name="LayoutRoot">
        <Grid.Resources>
            <esri:Editor x:Name="MyEditor" x:Key="MyEditor"
                         ContinuousMode="True" />
        </Grid.Resources>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="5" />
            <RowDefinition Height="150" />
        </Grid.RowDefinitions>
        <esri:Map Name="MyMap" UseAcceleratedDisplay="True" WrapAround="True">
            <esri:Map.Extent>
                <esri:Envelope XMin="-10603931.812" YMin="3384001.576" XMax="-10595782.642" YMax="3388315.896">
                    <esri:Envelope.SpatialReference>
                        <esri:SpatialReference WKID="102100" />
                    </esri:Envelope.SpatialReference>
                </esri:Envelope>
            </esri:Map.Extent>
            <esri:ArcGISTiledMapServiceLayer ID="Street Map"
                    Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" />
            <esri:FeatureLayer ID="SaveTheBayMarineLayer"
                    DisplayName="Save the Bay - Marine Layer"
                    Url="http://sampleserver6.arcgisonline.com/arcgis/rest/services/SaveTheBay/FeatureServer/0"                               
                    MouseLeftButtonDown="FeatureLayer_MouseLeftButtonDown"
                    InitializationFailed="FeatureLayer_InitializationFailed"
                    OutFields="type,confirmed,comments,creator,submitted"
                    Mode="OnDemand" />
        </esri:Map>
        <Grid Name="LoggedInGrid"
              HorizontalAlignment="Right"
              VerticalAlignment="Top"
              Margin="0,15,15,0"
              Visibility="Collapsed">
            <Rectangle Stroke="Gray"
                       
                       
                       Fill="LightGray"
                       Margin="-10">
                <Rectangle.Effect>
                    <DropShadowEffect />
                </Rectangle.Effect>
            </Rectangle>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <TextBlock Grid.Row="0"
                           Grid.ColumnSpan="2"
                           Text="{Binding ElementName=MyMap,Path=Layers[SaveTheBayMarineLayer].DisplayName}" />
                <TextBlock Text="Logged in as:"
                           Grid.Column="0"
                           Grid.Row="1"
                           Margin="2"
                           VerticalAlignment="Center" />
                <TextBlock Name="LoggedInUserTextBlock"
                           FontWeight="Bold"
                           HorizontalAlignment="Left"
                           Margin="2"
                           Grid.Column="1"
                           Grid.Row="1"
                           TextAlignment="Left" />
                <Button Name="ChangeUserButton"
                        Content="Sign Out"
                        Width="140"
                        Margin="0,5,0,5"
                        HorizontalAlignment="Center"
                        Grid.Row="2"
                        Grid.ColumnSpan="2"
                        Click="SignOut_Click" />
            </Grid>
        </Grid>
        <Border Name="ToolBorder"
                Background="LightGray"
                Visibility="Collapsed"
                BorderThickness="1"
                
                HorizontalAlignment="Left"
                VerticalAlignment="Top"
                Padding="5"
                BorderBrush="Black"
                Margin="5">
            <Border.Effect>
                <DropShadowEffect />
            </Border.Effect>
            <StackPanel Orientation="Vertical">
                <esri:TemplatePicker Map="{Binding ElementName=MyMap, Mode=OneWay}" LayerIDs="SaveTheBayMarineLayer" />
                <StackPanel DataContext="{StaticResource MyEditor}"
                            Orientation="Vertical">
                    <StackPanel Orientation="Horizontal">
                        <Button Command="{Binding ClearSelection}"
                                Margin="2">
                            <TextBlock>Clear<LineBreak />Selection</TextBlock>
                        </Button>
                        <Button Command="{Binding DeleteSelected}"
                                Margin="2">
                            <TextBlock>Delete<LineBreak />Selected</TextBlock>
                        </Button>
                    </StackPanel>
                </StackPanel>
            </StackPanel>
        </Border>
        <GridSplitter Grid.Row="1" HorizontalAlignment="Stretch" />
        <esri:FeatureDataGrid Grid.Row="2"
                              x:Name="MyDataGrid"
                              Map="{Binding ElementName=MyMap}"
                              SelectionMode="Single"
                              GraphicsLayer="{Binding ElementName=MyMap, Path=Layers.[SaveTheBayMarineLayer]}" />
    </Grid>
</UserControl>

Sample code usage restrictions
5/16/2014