Version 3.0.338

This commit is contained in:
Anja Müller-Meißner 2022-09-06 16:08:19 +02:00 committed by Anja
parent 573fe77e12
commit 0468955d49
751 changed files with 62747 additions and 60672 deletions

View file

@ -3,32 +3,32 @@ using TINK.Model.Connector.Filter;
namespace TINK.Model.User.Account
{
public static class AccountExtensions
{
/// <summary> Gets information whether user is logged in or not from account object. </summary>
/// <param name="account">Object to get information from.</param>
/// <returns>True if user is logged in, false if not.</returns>
public static bool GetIsLoggedIn(this IAccount account)
{
return !string.IsNullOrEmpty(account.Mail)
&& !string.IsNullOrEmpty(account.SessionCookie);
}
public static class AccountExtensions
{
/// <summary> Gets information whether user is logged in or not from account object. </summary>
/// <param name="account">Object to get information from.</param>
/// <returns>True if user is logged in, false if not.</returns>
public static bool GetIsLoggedIn(this IAccount account)
{
return !string.IsNullOrEmpty(account.Mail)
&& !string.IsNullOrEmpty(account.SessionCookie);
}
/// <summary>
/// Filters bike groups depending on whether user has access to all groups of bikes.
/// Some user may be "TINK"- user only, some "Konrad" and some may be "TINK" and "Konrad" users.
/// </summary>
/// <param name="account">Account to filter with.</param>
/// <param name="filter">Groups to filter.</param>
/// <returns>Filtered bike groups.</returns>
public static IEnumerable<string> DoFilter(
this IAccount account,
IEnumerable<string> filter)
{
/// <summary>
/// Filters bike groups depending on whether user has access to all groups of bikes.
/// Some user may be "TINK"- user only, some "Konrad" and some may be "TINK" and "Konrad" users.
/// </summary>
/// <param name="account">Account to filter with.</param>
/// <param name="filter">Groups to filter.</param>
/// <returns>Filtered bike groups.</returns>
public static IEnumerable<string> DoFilter(
this IAccount account,
IEnumerable<string> filter)
{
return GetIsLoggedIn(account)
? GroupFilterFactory.Create(account.Group).DoFilter(filter) // Filter if user is logged in.
: new NullGroupFilter().DoFilter(filter); // Do not filter if no user is logged in.
}
}
return GetIsLoggedIn(account)
? GroupFilterFactory.Create(account.Group).DoFilter(filter) // Filter if user is logged in.
: new NullGroupFilter().DoFilter(filter); // Do not filter if no user is logged in.
}
}
}