/// <summary>
        /// This method will return all allowed permission for the given <paramref name="userToken"/> and given the <paramref name="entityToken"/>.
        /// </summary>
        /// <param name="userToken">UserToken to get permissions for.</param>
        /// <param name="entityToken">EntityToken to get permissions for.</param>
        /// <returns>Allowed permission types</returns>
        public static IEnumerable <PermissionType> GetPermissions(UserToken userToken, EntityToken entityToken)
        {
            IEnumerable <UserPermissionDefinition>      userPermissionDefinitions      = PermissionTypeFacade.GetUserPermissionDefinitions(userToken.Username);
            IEnumerable <UserGroupPermissionDefinition> userGroupPermissionDefinitions = PermissionTypeFacade.GetUserGroupPermissionDefinitions(userToken.Username);

            IEnumerable <PermissionType> permissions = PermissionTypeFacade.GetCurrentPermissionTypes(userToken, entityToken, userPermissionDefinitions, userGroupPermissionDefinitions).Evaluate();

            return(permissions);
        }
        /// <exclude />
        public static SecurityResult Resolve(SecurityToken securityToken)
        {
            if (securityToken == null)
            {
                throw new ArgumentNullException("securityToken");
            }

            IEnumerable <UserPermissionDefinition>      userPermissionDefinitions     = PermissionTypeFacade.GetUserPermissionDefinitions(securityToken.UserToken.Username);
            IEnumerable <UserGroupPermissionDefinition> userGroupPermissionDefinition = PermissionTypeFacade.GetUserGroupPermissionDefinitions(securityToken.UserToken.Username);

            return(Resolve(securityToken.UserToken, securityToken.ActionToken, securityToken.EntityToken, userPermissionDefinitions, userGroupPermissionDefinition));
        }