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); }
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); }