示例#1
0
        public static AuthFunctionMsg ToMessage(this FunctionalAbility func, string appId)
        {
            AuthFunctionMsg msg = null;

            if (func != null)
            {
                msg = new AuthFunctionMsg()
                {
                    Name = func.Name,

                    ApplicationId = appId
                };
            }

            return(msg);
        }
示例#2
0
        public static List <AuthFunctionMsg> GetFunctions(this AuthorizationAssertion assert, string appId)
        {
            List <AuthFunctionMsg> functions = null;

            if (assert != null && assert.Roles != null)
            {
                functions = new List <AuthFunctionMsg>();

                foreach (BitKoo.Keystone.AuthService.Role role in assert.Roles)
                {
                    if (role != null && role.FunctionalAbilities != null)
                    {
                        foreach (FunctionalAbility func in role.FunctionalAbilities)
                        {
                            AuthFunctionMsg msg = func.ToMessage(appId);

                            functions.Add(msg);
                        }
                    }
                }
            }

            return(functions);
        }