Class Scope
Defines a scope path in Roster.
Inheritance
Namespace: Microsoft.GNS.Roster
Assembly: Microsoft.GNS.Roster.Common.dll
Syntax
public class Scope : object
Fields
View SourceEmpty
Represents and unset object.
Declaration
public static readonly Scope Empty
Field Value
Type | Description |
---|---|
Scope |
OrgIdentifier
Org scope identifier.
Declaration
public const string OrgIdentifier = null
Field Value
Type | Description |
---|---|
System.String |
ProjectIdentifier
Project scope identifier.
Declaration
public const string ProjectIdentifier = null
Field Value
Type | Description |
---|---|
System.String |
Root
The root Roster scope.
Declaration
public static readonly Scope Root
Field Value
Type | Description |
---|---|
Scope |
ToolIdentifier
Tool scope identifier.
Declaration
public const string ToolIdentifier = null
Field Value
Type | Description |
---|---|
System.String |
UserIdentifier
User scope identifier.
Declaration
public const string UserIdentifier = null
Field Value
Type | Description |
---|---|
System.String |
Methods
View SourceEquals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj |
Returns
Type | Description |
---|---|
System.Boolean |
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 |
GetScopeEntries()
Gets each scope section as a separate ScopeEntry.
Declaration
public IEnumerable<ScopeEntry> GetScopeEntries()
Returns
Type | Description |
---|---|
IEnumerable<ScopeEntry> | An enumeration of scope entries. |
IsUserScope(Guid, out Scope)
Determines if the scope is a user scope.
Declaration
public bool IsUserScope(Guid userId, out Scope baseNonUserScope)
Parameters
Type | Name | Description |
---|---|---|
Guid | userId | The user Id from AAD. |
Scope | baseNonUserScope | The scope sans the user portion. If non-user scope then that same scope is returned. |
Returns
Type | Description |
---|---|
System.Boolean | The non-user portion of the scope. |
OrgProjectScope(Guid, Guid)
Gets the user scope for an org and project metadata is associated with.
Declaration
public static Scope OrgProjectScope(Guid orgId, Guid projectId)
Parameters
Type | Name | Description |
---|---|---|
Guid | orgId | The org a tool belongs too. |
Guid | projectId | The project the metadata is associated with. |
Returns
Type | Description |
---|---|
Scope | The org project tool metadata scope. |
OrgProjectToolScope(Guid, Guid, Guid)
Gets the scope for an org, project, and tool metadata is associated with.
Declaration
public static Scope OrgProjectToolScope(Guid orgId, Guid projectId, Guid toolId)
Parameters
Type | Name | Description |
---|---|---|
Guid | orgId | The org a tool belongs too. |
Guid | projectId | The project the metadata is associated with. |
Guid | toolId | The tool the metadata is associated with. |
Returns
Type | Description |
---|---|
Scope | The org project tool metadata scope. |
OrgProjectToolUserScope(Guid, Guid, Guid, Guid)
Gets the scope for an org, project, and tool metadata is associated with.
Declaration
public static Scope OrgProjectToolUserScope(Guid orgId, Guid projectId, Guid toolId, Guid userId)
Parameters
Type | Name | Description |
---|---|---|
Guid | orgId | The org a tool belongs too. |
Guid | projectId | The project the metadata is associated with. |
Guid | toolId | The tool the metadata is associated with. |
Guid | userId | The user Id from AAD. |
Returns
Type | Description |
---|---|
Scope | The org project tool metadata scope. |
OrgProjectUserScope(Guid, Guid, Guid)
Gets the user scope for an org and project metadata is associated with.
Declaration
public static Scope OrgProjectUserScope(Guid orgId, Guid projectId, Guid userId)
Parameters
Type | Name | Description |
---|---|---|
Guid | orgId | The org a tool belongs too. |
Guid | projectId | The project the metadata is associated with. |
Guid | userId | The user Id from AAD. |
Returns
Type | Description |
---|---|
Scope | The org project tool metadata scope. |
OrgScope(Guid)
Gets the scope an org.
Declaration
public static Scope OrgScope(Guid orgId)
Parameters
Type | Name | Description |
---|---|---|
Guid | orgId | The Id of the org a tool belongs to. |
Returns
Type | Description |
---|---|
Scope | The org tool scope. |
OrgUserScope(Guid, Guid)
Gets the user scope for an org.
Declaration
public static Scope OrgUserScope(Guid orgId, Guid userId)
Parameters
Type | Name | Description |
---|---|---|
Guid | orgId | The Id of the org a tool belongs to. |
Guid | userId | The user Id from AAD. |
Returns
Type | Description |
---|---|
Scope | The org tool scope. |
Parse(Nullable<String>)
Parses a string into a Scope.
Declaration
public static Scope Parse(string? scopeString)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.String> | scopeString | The string to parse. |
Returns
Type | Description |
---|---|
Scope | A Scope determined to be of a valid format. |
SafeEncode()
Converts the scope to a system supported encoding.
Declaration
public string SafeEncode()
Returns
Type | Description |
---|---|
System.String | The encoded string. |
SubScopes()
Gets each subscope of the current scope as a scope.
Declaration
public IEnumerable<Scope> SubScopes()
Returns
Type | Description |
---|---|
IEnumerable<Scope> | An enumeration of scopes. |
ToOrgProjectScope(Guid)
Converts an org scope to a org/project scope.
Declaration
public Scope ToOrgProjectScope(Guid projectId)
Parameters
Type | Name | Description |
---|---|---|
Guid | projectId | The project to append to the org scope. |
Returns
Type | Description |
---|---|
Scope | The updated scope. |
ToOrgToolScope(Guid)
Converts an org scope to a org/tool scope.
Declaration
public Scope ToOrgToolScope(Guid toolId)
Parameters
Type | Name | Description |
---|---|---|
Guid | toolId | The tool to append to the org scope. |
Returns
Type | Description |
---|---|
Scope | The updated scope. |
ToString()
Converts the current scope into its string representation.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | This scope as a string. |
TryDecodeString(Nullable<String>, out Scope)
Tries to decode a string into a scope.
Declaration
public static bool TryDecodeString(string? encodedValue, out Scope scope)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.String> | encodedValue | The encoded string value. |
Scope | scope | The output Scope. |
Returns
Type | Description |
---|---|
System.Boolean | True if successfully decoded. Otherwise, false. |
TryParse(Nullable<String>, out Scope)
Attempts to parse string into a Scope.
Declaration
public static bool TryParse(string? scopeString, out Scope scope)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.String> | scopeString | The string to parse. |
Scope | scope | The output Scope object. |
Returns
Type | Description |
---|---|
System.Boolean | True if successfully parsed. Otherwise, false. |
UserScope(Guid)
Gets the scope for a user in the root.
Declaration
public static Scope UserScope(Guid userId)
Parameters
Type | Name | Description |
---|---|---|
Guid | userId | The user Id from AAD. |
Returns
Type | Description |
---|---|
Scope | The root user scope. |