init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
|
@ -0,0 +1,58 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Web;
|
||||
using Kreta.Core.Enum;
|
||||
using Kreta.Core.Exceptions;
|
||||
using Kreta.Naplo.Domain.V3.Common;
|
||||
using Kreta.Naplo.Domain.V3.Enum;
|
||||
|
||||
namespace Kreta.Naplo.WebApi.V3.Documentation.Helper
|
||||
{
|
||||
internal static class ExampleHelper
|
||||
{
|
||||
private static readonly bool s_isExampleValuesEnabled = bool.Parse(ConfigurationManager.AppSettings["IsExampleValuesEnabled"]);
|
||||
|
||||
public static void MockUser(MockUserName mockUserName)
|
||||
{
|
||||
const string MockMobileUserHttpContextKey = "MobileUser";
|
||||
|
||||
if (HttpContext.Current.Items.Contains(MockMobileUserHttpContextKey))
|
||||
{
|
||||
HttpContext.Current.Items.Remove(MockMobileUserHttpContextKey);
|
||||
}
|
||||
|
||||
const string MockUserIntemenyAzonosito = "biatorbagyi";
|
||||
const int MockUserTanevId = 5963;
|
||||
const string MockTanarUserName = "farkase";
|
||||
const int MockTanarUserId = 629608;
|
||||
var mockMobileTanarIdpUniqueId = new Guid("bf37a8ca-8c59-4030-b6e1-4c1f5e80da48");
|
||||
var mockInstituteUniqueId = new Guid("a88cf92a-8c24-4592-90c8-fb095b26ebdb");
|
||||
|
||||
switch (mockUserName)
|
||||
{
|
||||
case MockUserName.Farkase:
|
||||
HttpContext.Current.Items.Add(MockMobileUserHttpContextKey, new MobileUser(MockUserIntemenyAzonosito,
|
||||
MockTanarUserId,
|
||||
MockTanarUserName,
|
||||
new List<FelhasznaloSzerepkor> { FelhasznaloSzerepkor.Tanar },
|
||||
MockUserTanevId,
|
||||
mockMobileTanarIdpUniqueId,
|
||||
mockInstituteUniqueId));
|
||||
break;
|
||||
case MockUserName.None:
|
||||
default:
|
||||
throw new BlException(BlExceptionType.ElvartErtekNemTalalhato);
|
||||
}
|
||||
}
|
||||
|
||||
public static object TryGetExampleFeatureDefaultExampleModel()
|
||||
=> s_isExampleValuesEnabled ? null : new Dictionary<object, object>
|
||||
{
|
||||
{
|
||||
"Figyelmeztetés",
|
||||
"A példák nincsenek engedélyezve."
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue