コード例 #1
0
 //Support Methods
 private static string[] GetAllResourcesScopeStringList(SmartEnum.Entity Entity, SmartEnum.Action Action)
 {
     string[] ScopeList = new string[ModelInfo.SupportedResources.Count];
     for (int i = 0; i < ModelInfo.SupportedResources.Count; i++)
     {
         ScopeList[i] = GetScopeString(Entity, ModelInfo.SupportedResources[i], Action);
     }
     return(ScopeList);
 }
コード例 #2
0
        private static string GetScopeString(SmartEnum.Entity Entity, string Resource, SmartEnum.Action Action)
        {
            //user/*.write
            string ScopeString = string.Empty;

            if (Entity == SmartEnum.Entity.Patient)
            {
                ScopeString += KeyWord.Patient;
            }
            else if (Entity == SmartEnum.Entity.User)
            {
                ScopeString += KeyWord.User;
            }
            else
            {
                throw new FormatException($"Unkown Smart Scope Entity of {Entity.ToString()}");
            }

            ScopeString += KeyWord.SlashDelimiter;

            if (!String.IsNullOrWhiteSpace(Resource))
            {
                ScopeString += Resource;
            }
            else
            {
                throw new FormatException($"Unkown Smart Scope Resource of {Resource}");
            }

            ScopeString += KeyWord.DotDelimiter;

            if (Action == SmartEnum.Action.Read)
            {
                ScopeString += KeyWord.Read;
            }
            else if (Action == SmartEnum.Action.Write)
            {
                ScopeString += KeyWord.Write;
            }
            else if (Action == SmartEnum.Action.All)
            {
                ScopeString += KeyWord.All;
            }
            else
            {
                throw new FormatException($"Unkown Smart Scope Action of {Action.ToString()}");
            }

            return(ScopeString);
        }