Skip to content

Commit

Permalink
DisallowUserInstantiation property on Application to prevent manu…
Browse files Browse the repository at this point in the history
…al instantiation of instances (#426)
  • Loading branch information
martinothamar authored Jul 4, 2024
1 parent 1df3cb6 commit a329c97
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
8 changes: 5 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ root = true
#### Naming styles ####

[*.cs]

end_of_line = lf
tab_width = 4
indent_size = 4

# Naming rules

dotnet_naming_rule.private_or_internal_field_should_be_begins_with__.severity = suggestion
Expand Down Expand Up @@ -91,9 +96,6 @@ dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case
dotnet_style_operator_placement_when_wrapping = beginning_of_line
tab_width = 4
indent_size = 4
end_of_line = crlf
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
Expand Down
12 changes: 12 additions & 0 deletions src/Storage.Interface/Models/Application.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,18 @@ public class Application : ChangableElement

public CopyInstanceSettings CopyInstanceSettings { get; set; }

/// <summary>
/// Gets or sets a boolean value indicating if users (user tokens) are disallowed from instantiating.
/// Default value is <c>false</c>.
/// </summary>
/// <remarks>
/// If set to true, only organisations/system users can instantiate apps, but users
/// can still copy their own instances (if copying is enabled in the app).
/// Note that this configuration only affects production environment (to make testing easier).
/// </remarks>
[JsonProperty(PropertyName = "disallowUserInstantiation")]
public bool DisallowUserInstantiation { get; set; }

/// <inheritdoc/>
public override string ToString()
{
Expand Down
13 changes: 7 additions & 6 deletions src/Storage.Interface/Models/PartyTypesAllowed.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,33 @@
namespace Altinn.Platform.Storage.Interface.Models
{
/// <summary>
/// Represents an set of settings where application owner can define what types of parties
/// that are allowed to instantiate an application.
/// Represents a set of settings where application owner can define what types of parties
/// that are allowed to be owners of an instance in an application.
/// </summary>
/// <remarks>If all values are set to false (the default), then all types are allowed as owners</remarks>
[JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)]
public class PartyTypesAllowed
{
/// <summary>
/// Gets or sets a value indicating whether a bankruptcy estate is allowed to instantiate.
/// Gets or sets a value indicating whether a bankruptcy estate is allowed to be the owner of an instance.
/// </summary>
[JsonProperty(PropertyName = "bankruptcyEstate")]
public bool BankruptcyEstate { get; set; }

/// <summary>
/// Gets or sets a value indicating whether an organisation is allowed to instantiate.
/// Gets or sets a value indicating whether an organisation is allowed to be the owner of an instance.
/// </summary>
[JsonProperty(PropertyName = "organisation")]
public bool Organisation { get; set; }

/// <summary>
/// Gets or sets a value indicating whether a person is allowed to instantiate.
/// Gets or sets a value indicating whether a person is allowed to be the owner of an instance.
/// </summary>
[JsonProperty(PropertyName = "person")]
public bool Person { get; set; }

/// <summary>
/// Gets or sets a value indicating whether a sub unit is allowed to instantiate.
/// Gets or sets a value indicating whether a sub unit is allowed to be the owner of an instance.
/// </summary>
[JsonProperty(PropertyName = "subUnit")]
public bool SubUnit { get; set; }
Expand Down

0 comments on commit a329c97

Please sign in to comment.