Class UserAuthorizationInfo
Represents a selected user identity, that matches provided search criteria, along with the related user and his access level details.
Inherited Members
Namespace: Nevatech.Vsb.Repository.Security
Assembly: Nevatech.Vsb.Repository.dll
Syntax
public class UserAuthorizationInfo
Constructors
UserAuthorizationInfo()
Initializes an empty instance.
Declaration
public UserAuthorizationInfo()
Properties
ConsumerId
Gets or sets the consumer identifier if this user is the Developer Portal user.
Declaration
public int? ConsumerId { get; set; }
Property Value
| Type | Description |
|---|---|
| Nullable<Int32> |
Current
Gets authorization information for currently logged in user.
Declaration
public static UserAuthorizationInfo Current { get; }
Property Value
| Type | Description |
|---|---|
| UserAuthorizationInfo |
FolderId
Gets or sets identifier of the user's home folder.
Declaration
public int? FolderId { get; set; }
Property Value
| Type | Description |
|---|---|
| Nullable<Int32> |
FullName
Gets or sets user's full name.
Declaration
public string FullName { get; set; }
Property Value
| Type | Description |
|---|---|
| String |
IdentityKind
Gets or sets the kind of serialized identity.
Declaration
public IdentityKind IdentityKind { get; set; }
Property Value
| Type | Description |
|---|---|
| IdentityKind |
PortalPermission
Gets or sets user's maximum allowed access level (permission) in Developer Portal consumer account.
Declaration
public AccessLevel PortalPermission { get; set; }
Property Value
| Type | Description |
|---|---|
| AccessLevel |
RepositoryPermissions
Gets or sets the flags representing a set of permissions to Sentinet Repository actions that role grants access to.
Declaration
public RepositoryPermissions RepositoryPermissions { get; set; }
Property Value
| Type | Description |
|---|---|
| RepositoryPermissions |
UserId
Gets or sets authenticated user identifier.
Declaration
public int UserId { get; set; }
Property Value
| Type | Description |
|---|---|
| Int32 |
Methods
Create(ClaimsIdentity)
Looks for user authorization claim(s) in the provided user identity and create UserAuthorizationInfo populated with information from that claim(s).
Declaration
public static UserAuthorizationInfo Create(ClaimsIdentity identity)
Parameters
| Type | Name | Description |
|---|---|---|
| ClaimsIdentity | identity | Authenticated user identity where claims may be present. |
Returns
| Type | Description |
|---|---|
| UserAuthorizationInfo | New instance of UserAuthorizationInfo class populated from authorization claim(s) in the provided identity or Null, if no authorization claims have been found. |
Create(ClaimsPrincipal)
Looks for user authorization claim(s) in the provided user principal and create UserAuthorizationInfo populated with information from that claim(s).
Declaration
public static UserAuthorizationInfo Create(ClaimsPrincipal principal)
Parameters
| Type | Name | Description |
|---|---|---|
| ClaimsPrincipal | principal | Authenticated user principal where claims may be present. |
Returns
| Type | Description |
|---|---|
| UserAuthorizationInfo | New instance of UserAuthorizationInfo class populated from authorization claim(s) in one of the principal identities or Null, if no authorization claims have been found. |
EnsureEntityAccess(EntityType, ChangeTypes, Boolean)
Ensures that user has been granted the requested permissions to the specified entity type.
Declaration
public bool EnsureEntityAccess(EntityType entityType, ChangeTypes change = ChangeTypes.None, bool throwOnError = true)
Parameters
| Type | Name | Description |
|---|---|---|
| EntityType | entityType | Major entity type to check access for. |
| ChangeTypes | change | Action to be taken on the specified entity type. |
| Boolean | throwOnError | Flag indicating that UnauthorizedAccessException must be thrown, if user does not have permissions to the requested entity. If False then no exception is thrown, and caller must examine the method's return value. |
Returns
| Type | Description |
|---|---|
| Boolean | True if user has permissions to the requested entity. False, otherwise. |
EnsureFolderEntityAccess(FolderEntityTypes, ChangeTypes, Boolean)
Ensures that user has been granted the requested permissions to the specified folder entity type.
Declaration
public FolderEntityTypes EnsureFolderEntityAccess(FolderEntityTypes entities, ChangeTypes change = ChangeTypes.None, bool throwOnError = true)
Parameters
| Type | Name | Description |
|---|---|---|
| FolderEntityTypes | entities | Folder entity types that must be checked. |
| ChangeTypes | change | Action to be taken on the specified entity type. |
| Boolean | throwOnError | Flag indicating that UnauthorizedAccessException must be thrown, if user does not have permissions to any of the requested entities. If False then no exception is thrown, and caller must examine the method's return value. |
Returns
| Type | Description |
|---|---|
| FolderEntityTypes | Originally provided entities filtered out according to the current user permissions. |
EnsureRepositoryPermissions(Boolean, RepositoryPermissions[])
Ensures that user possesses any of the specified basic permissions.
Declaration
public bool EnsureRepositoryPermissions(bool throwOnError, params RepositoryPermissions[] permissions)
Parameters
| Type | Name | Description |
|---|---|---|
| Boolean | throwOnError | Flag indicating that UnauthorizedAccessException must be thrown, if user does not have permissions to any of the requested entities. If False then no exception is thrown, and caller must examine the method's return value. |
| RepositoryPermissions[] | permissions | List of Sentinet Repository permissions that user may have. If null or empty then user must have any permission. |
Returns
| Type | Description |
|---|---|
| Boolean | True if user possesses one or more of the specified permissions. False otherwise. |
EnsureViewServiceAccess(Nullable<Boolean>)
Ensures that user has view permissions to either physical or virtual services.
Declaration
public bool? EnsureViewServiceAccess(bool? isVirtual)
Parameters
| Type | Name | Description |
|---|---|---|
| Nullable<Boolean> | isVirtual | Flag indicating that user must have access to virtual services. If false then user must have access to physical services. If Null then user must have access to any services. |
Returns
| Type | Description |
|---|---|
| Nullable<Boolean> | Potentially modified original parameter according to permission granted to the user. |
Exceptions
| Type | Condition |
|---|---|
| UnauthorizedAccessException | Thrown if user has no view access to any services, or does not have view access to the requested service type. |
IssueClaims(ClaimsIdentity)
Adds user authorization claim(s) based on information in the current instance to provided identity.
Declaration
public void IssueClaims(ClaimsIdentity identity)
Parameters
| Type | Name | Description |
|---|---|---|
| ClaimsIdentity | identity | Identity where claims need to be added. |