Compare commits
1 Commits
v1.0.6-rc1
...
1.0.6-rc14
Author | SHA1 | Date | |
---|---|---|---|
8ce99cba13 |
@ -35,10 +35,3 @@ indent_style = space
|
|||||||
indent_size = 2
|
indent_size = 2
|
||||||
|
|
||||||
|
|
||||||
dotnet_naming_rule.locals_should_be_camel_case.severity = none
|
|
||||||
dotnet_naming_rule.locals_should_be_camel_case.symbols = locals_and_parameters
|
|
||||||
dotnet_naming_rule.locals_should_be_camel_case.style = camel_case_style
|
|
||||||
|
|
||||||
dotnet_naming_symbols.locals_and_parameters.applicable_kinds = parameter, local
|
|
||||||
|
|
||||||
dotnet_naming_style.camel_case_style.capitalization = camel_case
|
|
||||||
|
10
.travis.yml
10
.travis.yml
@ -6,11 +6,11 @@ sudo: false
|
|||||||
install:
|
install:
|
||||||
- curl --insecure -sSL https://lua.pschneider.fr/files/Paul/pub/dnx-install.sh | bash
|
- curl --insecure -sSL https://lua.pschneider.fr/files/Paul/pub/dnx-install.sh | bash
|
||||||
- DNX_USER_HOME=`pwd -P`/dnx . ./dnx/dnvm/dnvm.sh
|
- DNX_USER_HOME=`pwd -P`/dnx . ./dnx/dnvm/dnvm.sh
|
||||||
- cd src/OAuth.AspNet.Token && dnu restore --ignore-failed-sources
|
- cd src/OAuth.AspNet.Token && dnu restore
|
||||||
- cd ../OAuth.AspNet.AuthServer && dnu restore --ignore-failed-sources
|
- cd ../OAuth.AspNet.AuthServer && dnu restore
|
||||||
- cd ../Yavsc.Abstract && dnu restore --ignore-failed-sources
|
- cd ../Yavsc.Abstract && dnu restore
|
||||||
- cd ../Yavsc.Server && dnu restore --ignore-failed-sources
|
- cd ../Yavsc.Server && dnu restore
|
||||||
- cd ../Yavsc && dnu restore --ignore-failed-sources
|
- cd ../Yavsc && dnu restore
|
||||||
script:
|
script:
|
||||||
- "dnu build"
|
- "dnu build"
|
||||||
|
|
||||||
|
10
Makefile
10
Makefile
@ -7,18 +7,12 @@ CONFIG=Debug
|
|||||||
|
|
||||||
git_status := $(shell git status -s --porcelain |wc -l)
|
git_status := $(shell git status -s --porcelain |wc -l)
|
||||||
|
|
||||||
all: yavscd
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f src/Yavsc.Abstract/bin/$(CONFIG)/dnx451/Yavsc.Abstract.dll src/OAuth.AspNet.Token/bin/$(CONFIG)/dnx451/OAuth.AspNet.Token.dll src/OAuth.AspNet.AuthServer/bin/$(CONFIG)/dnx451/OAuth.AspNet.AuthServer.dll src/Yavsc.Server/bin/$(CONFIG)/dnx451/Yavsc.Server.dll src/Yavsc/bin/$(CONFIG)/dnx451/Yavsc.dll
|
rm -f src/Yavsc.Abstract/bin/$(CONFIG)/dnx451/Yavsc.Abstract.dll src/OAuth.AspNet.Token/bin/$(CONFIG)/dnx451/OAuth.AspNet.Token.dll src/OAuth.AspNet.AuthServer/bin/$(CONFIG)/dnx451/OAuth.AspNet.AuthServer.dll src/Yavsc.Server/bin/$(CONFIG)/dnx451/Yavsc.Server.dll src/Yavsc/bin/$(CONFIG)/dnx451/Yavsc.dll
|
||||||
|
|
||||||
checklibs:
|
checklibs:
|
||||||
ls $(DNXLIBFP)
|
ls $(DNXLIBFP)
|
||||||
|
|
||||||
updatedeps:
|
|
||||||
cp src/Yavsc/bin/output/approot/packages/*/*/lib/*net451*/*.dll private/lib/
|
|
||||||
cp src/Yavsc/bin/output/approot/packages/*/*/lib/*dnx451*/*.dll private/lib/
|
|
||||||
|
|
||||||
test:
|
test:
|
||||||
make -C src/test
|
make -C src/test
|
||||||
|
|
||||||
@ -61,8 +55,4 @@ yavscd: src/Yavsc/bin/$(CONFIG)/dnx451/Yavsc.dll src/Yavsc.Server/bin/$(CONFIG)/
|
|||||||
mkbundle --static $(DNXLIBS) src/Yavsc/bin/$(CONFIG)/dnx451/Yavsc.dll src/Yavsc/bin/$(CONFIG)/dnx451/pt/Yavsc.resources.dll src/Yavsc/bin/$(CONFIG)/dnx451/en/Yavsc.resources.dll src/Yavsc.Server/bin/$(CONFIG)/dnx451/Yavsc.Server.dll src/Yavsc.Server/bin/$(CONFIG)/dnx451/en/Yavsc.Server.resources.dll src/Yavsc.Abstract/bin/$(CONFIG)/dnx451/Yavsc.Abstract.dll src/Yavsc.Abstract/bin/$(CONFIG)/dnx451/en/Yavsc.Abstract.resources.dll src/Yavsc.Abstract/bin/$(CONFIG)/dnx451/pt/Yavsc.Abstract.resources.dll src/OAuth.AspNet.AuthServer/bin/$(CONFIG)/dnx451/OAuth.AspNet.AuthServer.dll src/OAuth.AspNet.Token/bin/$(CONFIG)/dnx451/OAuth.AspNet.Token.dll $(LIBS) -L $(DNX_USER_HOME)/runtimes/dnx-mono.1.0.0-rc1-update2/bin --machine-config $(MONO_PREFIX)/etc/mono/4.5/machine.config -o yavscd
|
mkbundle --static $(DNXLIBS) src/Yavsc/bin/$(CONFIG)/dnx451/Yavsc.dll src/Yavsc/bin/$(CONFIG)/dnx451/pt/Yavsc.resources.dll src/Yavsc/bin/$(CONFIG)/dnx451/en/Yavsc.resources.dll src/Yavsc.Server/bin/$(CONFIG)/dnx451/Yavsc.Server.dll src/Yavsc.Server/bin/$(CONFIG)/dnx451/en/Yavsc.Server.resources.dll src/Yavsc.Abstract/bin/$(CONFIG)/dnx451/Yavsc.Abstract.dll src/Yavsc.Abstract/bin/$(CONFIG)/dnx451/en/Yavsc.Abstract.resources.dll src/Yavsc.Abstract/bin/$(CONFIG)/dnx451/pt/Yavsc.Abstract.resources.dll src/OAuth.AspNet.AuthServer/bin/$(CONFIG)/dnx451/OAuth.AspNet.AuthServer.dll src/OAuth.AspNet.Token/bin/$(CONFIG)/dnx451/OAuth.AspNet.Token.dll $(LIBS) -L $(DNX_USER_HOME)/runtimes/dnx-mono.1.0.0-rc1-update2/bin --machine-config $(MONO_PREFIX)/etc/mono/4.5/machine.config -o yavscd
|
||||||
strip yavscd
|
strip yavscd
|
||||||
|
|
||||||
version-increment-patch:
|
|
||||||
scripts/version.sh $$(cat version.txt) patch > version.txt
|
|
||||||
|
|
||||||
|
|
||||||
.PHONY: packages
|
.PHONY: packages
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
"Dnx": {
|
"Dnx": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"enablePackageRestore": false,
|
"enablePackageRestore": false,
|
||||||
"projects": "src/*/project.json;*/project.json;project.json;test/*/project.json"
|
"projects": "src/*/project.json;*/project.json;project.json;test/*/project.json"
|
||||||
},
|
},
|
||||||
"Script": {
|
"Script": {
|
||||||
"enabled": false
|
"enabled": false
|
||||||
|
@ -1,44 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
version="$1"
|
|
||||||
major=0
|
|
||||||
minor=0
|
|
||||||
build=0
|
|
||||||
|
|
||||||
# break down the version number into it's components
|
|
||||||
regex="([0-9]+).([0-9]+).([0-9]+)((-[A-Za-z]+)([0-9]+))?"
|
|
||||||
if [[ $version =~ $regex ]]; then
|
|
||||||
major="${BASH_REMATCH[1]}"
|
|
||||||
minor="${BASH_REMATCH[2]}"
|
|
||||||
build="${BASH_REMATCH[3]}"
|
|
||||||
patchtype="${BASH_REMATCH[5]}"
|
|
||||||
patchnum="${BASH_REMATCH[6]}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check paramater to see which number to increment
|
|
||||||
if [[ "$2" == "feature" ]]; then
|
|
||||||
minor=$(echo $minor + 1 | bc)
|
|
||||||
build=0
|
|
||||||
patchtype=
|
|
||||||
patchnum=
|
|
||||||
elif [[ "$2" == "build" ]]; then
|
|
||||||
build=$(echo $build + 1 | bc)
|
|
||||||
patchtype=
|
|
||||||
patchnum=
|
|
||||||
elif [[ "$2" == "major" ]]; then
|
|
||||||
major=$(echo $major+1 | bc)
|
|
||||||
minor=0
|
|
||||||
build=0
|
|
||||||
patchtype=
|
|
||||||
patchnum=
|
|
||||||
elif [[ "$2" == "patch" ]]; then
|
|
||||||
patchnum=$(echo $patchnum + 1 | bc)
|
|
||||||
else
|
|
||||||
echo "usage: ./version.sh version_number [major/feature/build/patch]" >&2
|
|
||||||
|
|
||||||
exit -1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# echo the new version number
|
|
||||||
echo "${major}.${minor}.${build}${patchtype}${patchnum}"
|
|
||||||
|
|
@ -33,7 +33,7 @@ namespace OAuth.AspNet.AuthServer
|
|||||||
|
|
||||||
MemoryStream stream, memoryStream = null;
|
MemoryStream stream, memoryStream = null;
|
||||||
|
|
||||||
StreamWriter streamWriter;
|
StreamWriter streamWriter = null;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
"defaultNamespace": "Yavsc"
|
"defaultNamespace": "Yavsc"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Newtonsoft.Json": "7.0.1",
|
"Newtonsoft.Json": "6.0.1-beta1",
|
||||||
"Microsoft.AspNet.Identity.EntityFramework": "3.0.0-rc1-*",
|
"Microsoft.AspNet.Identity.EntityFramework": "3.0.0-rc1-*",
|
||||||
"OAuth.AspNet.Token": {
|
"OAuth.AspNet.Token": {
|
||||||
"type": "build",
|
"type": "build",
|
||||||
|
@ -27,7 +27,7 @@ namespace OAuth.AspNet.Tokens
|
|||||||
|
|
||||||
#region non-Public Members
|
#region non-Public Members
|
||||||
|
|
||||||
private readonly TicketDataFormat _ticketDataFormat;
|
private TicketDataFormat _ticketDataFormat;
|
||||||
|
|
||||||
private const string _serializationRegex = @"^[A-Za-z0-9-_]*$";
|
private const string _serializationRegex = @"^[A-Za-z0-9-_]*$";
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
"defaultNamespace": "Yavsc"
|
"defaultNamespace": "Yavsc"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Newtonsoft.Json": "7.0.1",
|
"Newtonsoft.Json": "6.0.1-beta1",
|
||||||
"Microsoft.AspNet.Authentication.JwtBearer": "1.0.0-rc1-final",
|
"Microsoft.AspNet.Authentication.JwtBearer": "1.0.0-rc1-final",
|
||||||
"Microsoft.AspNet.DataProtection": "1.0.0-rc1-final"
|
"Microsoft.AspNet.DataProtection": "1.0.0-rc1-final"
|
||||||
},
|
},
|
||||||
|
@ -5,7 +5,7 @@ namespace Yavsc.Attributes.Validation
|
|||||||
public partial class YaStringLength: YaValidationAttribute
|
public partial class YaStringLength: YaValidationAttribute
|
||||||
{
|
{
|
||||||
public long MinimumLength { get; set; } = 0;
|
public long MinimumLength { get; set; } = 0;
|
||||||
private readonly long maxLen;
|
private long maxLen;
|
||||||
public YaStringLength(long maxLen) : base( ()=> "BadStringLength")
|
public YaStringLength(long maxLen) : base( ()=> "BadStringLength")
|
||||||
{
|
{
|
||||||
this.maxLen = maxLen;
|
this.maxLen = maxLen;
|
||||||
@ -50,4 +50,4 @@ namespace Yavsc.Attributes.Validation
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -16,15 +16,15 @@ namespace Yavsc.Authentication
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
string clientId;
|
||||||
|
string clientSecret;
|
||||||
|
string scope;
|
||||||
|
Uri authorizeUrl;
|
||||||
|
Uri accessTokenUrl;
|
||||||
|
Uri redirectUrl;
|
||||||
|
GetUsernameAsyncFunc getUsernameAsync;
|
||||||
|
|
||||||
readonly string clientId;
|
string requestState;
|
||||||
readonly string clientSecret;
|
|
||||||
readonly string scope;
|
|
||||||
readonly Uri authorizeUrl;
|
|
||||||
readonly Uri accessTokenUrl;
|
|
||||||
readonly Uri redirectUrl;
|
|
||||||
readonly GetUsernameAsyncFunc getUsernameAsync;
|
|
||||||
readonly string requestState;
|
|
||||||
bool reportedForgery = false;
|
bool reportedForgery = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -48,7 +48,7 @@ namespace Yavsc
|
|||||||
public const string YavscConnectionStringEnvName = "YAVSC_DB_CONNECTION";
|
public const string YavscConnectionStringEnvName = "YAVSC_DB_CONNECTION";
|
||||||
|
|
||||||
// at the end, let 4*4 bytes in peace
|
// at the end, let 4*4 bytes in peace
|
||||||
public const int WebSocketsMaxBufLen = 4096;
|
public const int WebSocketsMaxBufLen = 4 * 1020;
|
||||||
|
|
||||||
public static readonly long DefaultFSQ = 1024 * 1024 * 500;
|
public static readonly long DefaultFSQ = 1024 * 1024 * 500;
|
||||||
|
|
||||||
@ -60,7 +60,5 @@ namespace Yavsc
|
|||||||
public const int MaxUserNameLength = 26;
|
public const int MaxUserNameLength = 26;
|
||||||
|
|
||||||
public const string LivePath = "/live/cast";
|
public const string LivePath = "/live/cast";
|
||||||
|
|
||||||
public const string StreamingPath = "/api/stream/put";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ namespace Yavsc.Helpers
|
|||||||
{
|
{
|
||||||
public static string UserBillsDirName { set; get; }
|
public static string UserBillsDirName { set; get; }
|
||||||
public static string UserFilesDirName { set; get; }
|
public static string UserFilesDirName { set; get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Is Valid this Path?
|
/// Is Valid this Path?
|
||||||
/// Return true when given value is a valid user file sub-path,
|
/// Return true when given value is a valid user file sub-path,
|
||||||
@ -37,18 +37,7 @@ namespace Yavsc.Helpers
|
|||||||
{
|
{
|
||||||
return !name.Any(c => !ValidFileNameChars.Contains(c));
|
return !name.Any(c => !ValidFileNameChars.Contains(c));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsValidShortFileName(this string name)
|
|
||||||
{
|
|
||||||
if (name.Any(c => !ValidFileNameChars.Contains(c)))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (!name.Any(c => !AlfaNum.Contains(c)))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ensure this path is canonical,
|
// Ensure this path is canonical,
|
||||||
// No "dirto/./this", neither "dirt/to/that/"
|
// No "dirto/./this", neither "dirt/to/that/"
|
||||||
// no .. and each char must be listed as valid in constants
|
// no .. and each char must be listed as valid in constants
|
||||||
@ -60,11 +49,11 @@ namespace Yavsc.Helpers
|
|||||||
{
|
{
|
||||||
if (ValidFileNameChars.Contains(c))
|
if (ValidFileNameChars.Contains(c))
|
||||||
sb.Append(c);
|
sb.Append(c);
|
||||||
else sb.Append("#" + ((int)c).ToString("D3"));
|
else sb.Append("#"+((int)c).ToString("D3"));
|
||||||
}
|
}
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UserDirectoryInfo GetUserFiles(string userName, string subdir)
|
public static UserDirectoryInfo GetUserFiles(string userName, string subdir)
|
||||||
{
|
{
|
||||||
UserDirectoryInfo di = new UserDirectoryInfo(UserFilesDirName, userName, subdir);
|
UserDirectoryInfo di = new UserDirectoryInfo(UserFilesDirName, userName, subdir);
|
||||||
@ -80,13 +69,12 @@ namespace Yavsc.Helpers
|
|||||||
// Server side only supports POSIX file systems
|
// Server side only supports POSIX file systems
|
||||||
public const char RemoteDirectorySeparator = '/';
|
public const char RemoteDirectorySeparator = '/';
|
||||||
|
|
||||||
public static char[] AlfaNum = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".ToCharArray();
|
|
||||||
// Only accept descent remote file names
|
// Only accept descent remote file names
|
||||||
public static char[] ValidFileNameChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-=_~. %#".ToCharArray();
|
public static char[] ValidFileNameChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-=_~. %#".ToCharArray();
|
||||||
|
|
||||||
// Estimate signature file name format
|
// Estimate signature file name format
|
||||||
public static Func<string, string, long, string>
|
public static Func<string,string,long,string>
|
||||||
SignFileNameFormat = new Func<string, string, long, string>((signType, billingCode, estimateId) => $"sign-{billingCode}-{signType}-{estimateId}.png");
|
SignFileNameFormat = new Func<string,string,long,string> ((signType,billingCode,estimateId) => $"sign-{billingCode}-{signType}-{estimateId}.png");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ namespace Yavsc.Abstract.FileSystem
|
|||||||
{
|
{
|
||||||
public interface IFileRecievedInfo
|
public interface IFileRecievedInfo
|
||||||
{
|
{
|
||||||
|
string MimeType { get; set; }
|
||||||
|
|
||||||
string DestDir { get; set; }
|
string DestDir { get; set; }
|
||||||
|
|
||||||
@ -11,4 +12,4 @@ namespace Yavsc.Abstract.FileSystem
|
|||||||
|
|
||||||
bool QuotaOffensed { get; set; }
|
bool QuotaOffensed { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -16,7 +16,7 @@ namespace Yavsc.ViewModels.UserFiles
|
|||||||
public DirectoryShortInfo [] SubDirectories {
|
public DirectoryShortInfo [] SubDirectories {
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
private readonly DirectoryInfo dInfo;
|
private DirectoryInfo dInfo;
|
||||||
|
|
||||||
// for deserialization
|
// for deserialization
|
||||||
public UserDirectoryInfo()
|
public UserDirectoryInfo()
|
||||||
|
@ -3,7 +3,7 @@ namespace Yavsc.Models.Process
|
|||||||
{
|
{
|
||||||
public class Negation<Exp> : IRequisition where Exp : IRequisition
|
public class Negation<Exp> : IRequisition where Exp : IRequisition
|
||||||
{
|
{
|
||||||
readonly Exp _expression;
|
Exp _expression;
|
||||||
public Negation(Exp expression)
|
public Negation(Exp expression)
|
||||||
{
|
{
|
||||||
_expression = expression;
|
_expression = expression;
|
||||||
|
@ -24,14 +24,11 @@
|
|||||||
"Chat"
|
"Chat"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"buildOptions": {
|
|
||||||
"nowarn": ["IDE1006"]
|
|
||||||
},
|
|
||||||
"tooling": {
|
"tooling": {
|
||||||
"defaultNamespace": "Yavsc"
|
"defaultNamespace": "Yavsc"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Newtonsoft.Json": "7.0.1"
|
"Newtonsoft.Json": "6.0.1-beta1"
|
||||||
},
|
},
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
"dnx451": {
|
"dnx451": {
|
||||||
|
@ -31,7 +31,7 @@ namespace Yavsc.Server.Helpers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class SimpleJsonPostMethod : IDisposable
|
public class SimpleJsonPostMethod : IDisposable
|
||||||
{
|
{
|
||||||
private readonly HttpWebRequest request=null;
|
private HttpWebRequest request=null;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the Yavsc.Helpers.SimpleJsonPostMethod class.
|
/// Initializes a new instance of the Yavsc.Helpers.SimpleJsonPostMethod class.
|
||||||
|
@ -31,7 +31,7 @@ namespace Yavsc.Services
|
|||||||
/// I calendar manager.
|
/// I calendar manager.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface ICalendarManager {
|
public interface ICalendarManager {
|
||||||
Task<CalendarList> GetCalendarsAsync (string pageToken);
|
Task<CalendarList> GetCalendarsAsync (string userId, string pageToken);
|
||||||
Task<Events> GetCalendarAsync (string calid, DateTime minDate, DateTime maxDate, string pageToken);
|
Task<Events> GetCalendarAsync (string calid, DateTime minDate, DateTime maxDate, string pageToken);
|
||||||
Task<DateTimeChooserViewModel> CreateViewModelAsync(
|
Task<DateTimeChooserViewModel> CreateViewModelAsync(
|
||||||
string inputId,
|
string inputId,
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
using System;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
@ -9,7 +8,6 @@ using Yavsc.Models.Relationship;
|
|||||||
|
|
||||||
namespace Yavsc.Server.Models.Access
|
namespace Yavsc.Server.Models.Access
|
||||||
{
|
{
|
||||||
[Obsolete]
|
|
||||||
public class CircleAuthorizationToFile : ICircleAuthorization
|
public class CircleAuthorizationToFile : ICircleAuthorization
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -30,13 +30,14 @@ namespace Yavsc.Models.FileSystem
|
|||||||
public FileRecievedInfo()
|
public FileRecievedInfo()
|
||||||
{
|
{
|
||||||
QuotaOffensed = Overriden = false;
|
QuotaOffensed = Overriden = false;
|
||||||
DestDir = FileName = null;
|
MimeType = DestDir = FileName = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string MimeType { get; set; }
|
||||||
public string DestDir { get; set; }
|
public string DestDir { get; set; }
|
||||||
public string FileName { get; set; }
|
public string FileName { get; set; }
|
||||||
public bool Overriden { get; set; }
|
public bool Overriden { get; set; }
|
||||||
|
|
||||||
public bool QuotaOffensed { get; set; }
|
public bool QuotaOffensed { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -34,19 +34,19 @@ namespace Yavsc.Models.HairCut
|
|||||||
|
|
||||||
public string Sender { get; set; }
|
public string Sender { get; set; }
|
||||||
|
|
||||||
readonly HairCutQuery query;
|
HairCutQuery query;
|
||||||
|
|
||||||
private readonly string invoiceId;
|
private string invoiceId;
|
||||||
private readonly string payerName;
|
private string payerName;
|
||||||
private readonly string phone;
|
private string phone;
|
||||||
private readonly string payerEmail;
|
private string payerEmail;
|
||||||
private readonly string amount;
|
private string amount;
|
||||||
private readonly HairCutGenders gender;
|
private HairCutGenders gender;
|
||||||
private readonly string date;
|
private string date;
|
||||||
private readonly string lieu;
|
private string lieu;
|
||||||
private readonly string clientFinal;
|
private string clientFinal;
|
||||||
private readonly string token;
|
private string token;
|
||||||
private readonly string payerId;
|
private string payerId;
|
||||||
|
|
||||||
public string CreateBody()
|
public string CreateBody()
|
||||||
{
|
{
|
||||||
@ -73,4 +73,4 @@ Le client final: {clientFinal}
|
|||||||
";
|
";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -140,7 +140,7 @@ Prestation.Gender == HairCutGenders.Women ?
|
|||||||
bill.Add(new CommandLine
|
bill.Add(new CommandLine
|
||||||
{
|
{
|
||||||
Name = name,
|
Name = name,
|
||||||
Description = name + shorthairsuffix,
|
Description = name = name + shorthairsuffix,
|
||||||
UnitaryCost = multicolor ? SelectedProfile.ShortMultiColorPrice : SelectedProfile.ShortColorPrice
|
UnitaryCost = multicolor ? SelectedProfile.ShortMultiColorPrice : SelectedProfile.ShortColorPrice
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -36,5 +36,6 @@ namespace Yavsc.Models.Haircut
|
|||||||
private set;
|
private set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HairCutQuery Data { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ namespace Yavsc.Server.Models.IT
|
|||||||
[ForeignKey("GitId")]
|
[ForeignKey("GitId")]
|
||||||
public virtual GitRepositoryReference Repository { get; set; }
|
public virtual GitRepositoryReference Repository { get; set; }
|
||||||
|
|
||||||
readonly List<IBillItem> bill = new List<IBillItem>();
|
List<IBillItem> bill = new List<IBillItem>();
|
||||||
public void AddBillItem(IBillItem item)
|
public void AddBillItem(IBillItem item)
|
||||||
{
|
{
|
||||||
bill.Add(item);
|
bill.Add(item);
|
||||||
|
@ -47,7 +47,7 @@ namespace Yavsc.Server.Models.IT.SourceCode
|
|||||||
writer.WriteLine(process.StandardOutput.ReadLine());
|
writer.WriteLine(process.StandardOutput.ReadLine());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ResultHandler?.Invoke(true);
|
if (ResultHandler!=null) ResultHandler(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,8 +36,8 @@ namespace Yavsc.Server.Models.IT.SourceCode
|
|||||||
writer.WriteLine(process.StandardOutput.ReadLine());
|
writer.WriteLine(process.StandardOutput.ReadLine());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ResultHandler?.Invoke(true);
|
if (ResultHandler!=null) ResultHandler(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -21,7 +21,7 @@ public class Announce : BaseEvent, IAnnounce, IOwned
|
|||||||
public string Message { get; set; }
|
public string Message { get; set; }
|
||||||
public override string CreateBody()
|
public override string CreateBody()
|
||||||
{
|
{
|
||||||
return $"Annonce de {Owner.UserName}: {For}\n\n{Message}";
|
return $"Annonce de {Owner.UserName}: {For.ToString()}\n\n{Message}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,14 +24,13 @@ namespace Yavsc.Models.Messaging
|
|||||||
Sender = perfer.Performer.UserName;
|
Sender = perfer.Performer.UserName;
|
||||||
_localizer = SR;
|
_localizer = SR;
|
||||||
}
|
}
|
||||||
|
// TODO via e-mail only: Message = string.Format(
|
||||||
// TODO via e-mail only: Message = string.Format(
|
// SR["EstimationMessageToClient"],perfer.Performer.UserName, estimate.Title,estimate.Bill.Addition());
|
||||||
// SR["EstimationMessageToClient"],perfer.Performer.UserName, estimate.Title,estimate.Bill.Addition());
|
//
|
||||||
|
|
||||||
ProviderClientInfo ProviderInfo { get; set; }
|
ProviderClientInfo ProviderInfo { get; set; }
|
||||||
Estimate Estimation { get; set; }
|
Estimate Estimation { get; set; }
|
||||||
|
|
||||||
private readonly PerformerProfile perfer;
|
private PerformerProfile perfer;
|
||||||
|
|
||||||
public string Topic
|
public string Topic
|
||||||
{
|
{
|
||||||
@ -47,7 +46,7 @@ namespace Yavsc.Models.Messaging
|
|||||||
|
|
||||||
public string CreateBody()
|
public string CreateBody()
|
||||||
{
|
{
|
||||||
return string.Format(_localizer["EstimationMessageToClient"], perfer.Performer.UserName, this.Estimation.Bill.Addition());
|
return string.Format( _localizer["EstimationMessageToClient"], perfer.Performer.UserName, this.Estimation.Bill.Addition());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,17 +65,5 @@ namespace Yavsc
|
|||||||
/// <returns>the supported activity code</returns>
|
/// <returns>the supported activity code</returns>
|
||||||
public string OnlyOneActivityCode { get; set; }
|
public string OnlyOneActivityCode { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Disk usage user list maximum length in memory
|
|
||||||
/// </summary>
|
|
||||||
/// <value></value>
|
|
||||||
public int DUUserListLen { get; set; } = 256;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Default acl file name
|
|
||||||
/// </summary>
|
|
||||||
/// <value></value>
|
|
||||||
public string AccessListFileName { get; set; } = ".access";
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,8 +41,7 @@
|
|||||||
"Resources/**/*.resx"
|
"Resources/**/*.resx"
|
||||||
],
|
],
|
||||||
"publicSign": false,
|
"publicSign": false,
|
||||||
"keyFile": "../../../sgKey.snk",
|
"keyFile": "../../../sgKey.snk"
|
||||||
"nowarn": ["IDE1006"]
|
|
||||||
},
|
},
|
||||||
"tooling": {
|
"tooling": {
|
||||||
"defaultNamespace": "Yavsc"
|
"defaultNamespace": "Yavsc"
|
||||||
|
@ -16,7 +16,7 @@ namespace Yavsc.Controllers
|
|||||||
|
|
||||||
public class BlogApiController : Controller
|
public class BlogApiController : Controller
|
||||||
{
|
{
|
||||||
private readonly ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
public BlogApiController(ApplicationDbContext context)
|
public BlogApiController(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
|
@ -12,7 +12,7 @@ namespace Yavsc.Controllers
|
|||||||
[Route("api/blogtags")]
|
[Route("api/blogtags")]
|
||||||
public class BlogTagsApiController : Controller
|
public class BlogTagsApiController : Controller
|
||||||
{
|
{
|
||||||
private readonly ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
public BlogTagsApiController(ApplicationDbContext context)
|
public BlogTagsApiController(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
@ -144,4 +144,4 @@ namespace Yavsc.Controllers
|
|||||||
return _context.TagsDomain.Count(e => e.PostId == id) > 0;
|
return _context.TagsDomain.Count(e => e.PostId == id) > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,7 +14,7 @@ namespace Yavsc.Controllers
|
|||||||
[Route("api/blogcomments")]
|
[Route("api/blogcomments")]
|
||||||
public class CommentsApiController : Controller
|
public class CommentsApiController : Controller
|
||||||
{
|
{
|
||||||
private readonly ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
public CommentsApiController(ApplicationDbContext context)
|
public CommentsApiController(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
@ -158,4 +158,4 @@ namespace Yavsc.Controllers
|
|||||||
return _context.Comment.Count(e => e.Id == id) > 0;
|
return _context.Comment.Count(e => e.Id == id) > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -20,9 +20,9 @@ namespace Yavsc.ApiControllers
|
|||||||
[Authorize,Route("api/fs")]
|
[Authorize,Route("api/fs")]
|
||||||
public partial class FileSystemApiController : Controller
|
public partial class FileSystemApiController : Controller
|
||||||
{
|
{
|
||||||
readonly ApplicationDbContext dbContext;
|
ApplicationDbContext dbContext;
|
||||||
private readonly IAuthorizationService AuthorizationService;
|
private IAuthorizationService AuthorizationService;
|
||||||
private readonly ILogger _logger;
|
private ILogger _logger;
|
||||||
|
|
||||||
public FileSystemApiController(ApplicationDbContext context,
|
public FileSystemApiController(ApplicationDbContext context,
|
||||||
IAuthorizationService authorizationService,
|
IAuthorizationService authorizationService,
|
||||||
@ -180,8 +180,6 @@ namespace Yavsc.ApiControllers
|
|||||||
}
|
}
|
||||||
return Ok(new { deleted=id });
|
return Ok(new { deleted=id });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,72 +0,0 @@
|
|||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Security.Claims;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Microsoft.AspNet.Authorization;
|
|
||||||
using Microsoft.AspNet.Mvc;
|
|
||||||
using Microsoft.Data.Entity;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using Yavsc.Attributes.Validation;
|
|
||||||
using Yavsc.Helpers;
|
|
||||||
using Yavsc.Models;
|
|
||||||
using Yavsc.Models.Messaging;
|
|
||||||
using Yavsc.Services;
|
|
||||||
|
|
||||||
namespace Yavsc.ApiControllers
|
|
||||||
{
|
|
||||||
[Authorize, Route("api/stream")]
|
|
||||||
public partial class FileSystemStreamController : Controller
|
|
||||||
{
|
|
||||||
private readonly ILogger logger;
|
|
||||||
private readonly ILiveProcessor liveProcessor;
|
|
||||||
readonly ApplicationDbContext dbContext;
|
|
||||||
|
|
||||||
public FileSystemStreamController(ApplicationDbContext context, ILiveProcessor liveProcessor, ILoggerFactory loggerFactory)
|
|
||||||
{
|
|
||||||
this.dbContext = context;
|
|
||||||
this.logger = loggerFactory.CreateLogger<FileSystemStreamController>();
|
|
||||||
this.liveProcessor = liveProcessor;
|
|
||||||
}
|
|
||||||
|
|
||||||
[Authorize, Route("put/{filename}")]
|
|
||||||
public async Task<IActionResult> Put([ValidRemoteUserFilePath] string filename)
|
|
||||||
{
|
|
||||||
logger.LogInformation("Put : " + filename);
|
|
||||||
if (!HttpContext.WebSockets.IsWebSocketRequest)
|
|
||||||
return HttpBadRequest("not a web socket");
|
|
||||||
if (!HttpContext.User.Identity.IsAuthenticated)
|
|
||||||
return new HttpUnauthorizedResult();
|
|
||||||
var subdirs = filename.Split('/');
|
|
||||||
var filePath = subdirs.Length > 1 ? string.Join("/", subdirs.Take(subdirs.Length-1)) : null;
|
|
||||||
var shortFileName = subdirs[subdirs.Length-1];
|
|
||||||
if (!shortFileName.IsValidShortFileName())
|
|
||||||
{
|
|
||||||
logger.LogInformation("invalid file name : " + filename);
|
|
||||||
return HttpBadRequest("invalid file name");
|
|
||||||
}
|
|
||||||
logger.LogInformation("validated: api/stream/Put: "+filename);
|
|
||||||
var userName = User.GetUserName();
|
|
||||||
var hubContext = Microsoft.AspNet.SignalR.GlobalHost.ConnectionManager.GetHubContext<ChatHub>();
|
|
||||||
string url = string.Format(
|
|
||||||
"{0}/{1}/{2}",
|
|
||||||
Startup.UserFilesOptions.RequestPath.ToUriComponent(),
|
|
||||||
userName,
|
|
||||||
filename
|
|
||||||
);
|
|
||||||
|
|
||||||
hubContext.Clients.All.addPublicStream(new PublicStreamInfo
|
|
||||||
{
|
|
||||||
sender = userName,
|
|
||||||
url = url,
|
|
||||||
}, $"{userName} is starting a stream!");
|
|
||||||
|
|
||||||
string destDir = HttpContext.User.InitPostToFileSystem(filePath);
|
|
||||||
logger.LogInformation($"Saving flow to {destDir}");
|
|
||||||
var userId = User.GetUserId();
|
|
||||||
var user = await dbContext.Users.FirstAsync(u => u.Id == userId);
|
|
||||||
logger.LogInformation("Accepting stream ...");
|
|
||||||
await liveProcessor.AcceptStream(HttpContext, user, destDir, shortFileName);
|
|
||||||
return Ok();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -25,15 +25,15 @@ namespace Yavsc.ApiControllers
|
|||||||
[Route("api/bill"), Authorize]
|
[Route("api/bill"), Authorize]
|
||||||
public class BillingController : Controller
|
public class BillingController : Controller
|
||||||
{
|
{
|
||||||
readonly ApplicationDbContext dbContext;
|
ApplicationDbContext dbContext;
|
||||||
private readonly IStringLocalizer _localizer;
|
private IStringLocalizer _localizer;
|
||||||
private readonly GoogleAuthSettings _googleSettings;
|
private GoogleAuthSettings _googleSettings;
|
||||||
private readonly IYavscMessageSender _GCMSender;
|
private IYavscMessageSender _GCMSender;
|
||||||
private readonly IAuthorizationService authorizationService;
|
private IAuthorizationService authorizationService;
|
||||||
|
|
||||||
|
|
||||||
private readonly ILogger logger;
|
private ILogger logger;
|
||||||
private readonly IBillingService billingService;
|
private IBillingService billingService;
|
||||||
|
|
||||||
public BillingController(
|
public BillingController(
|
||||||
IAuthorizationService authorizationService,
|
IAuthorizationService authorizationService,
|
||||||
|
@ -13,11 +13,11 @@ using Yavsc.Models.Billing;
|
|||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
[Route("api/estimate"), Authorize()]
|
[Route("api/estimate"),Authorize()]
|
||||||
public class EstimateApiController : Controller
|
public class EstimateApiController : Controller
|
||||||
{
|
{
|
||||||
private readonly ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
private readonly ILogger _logger;
|
private ILogger _logger;
|
||||||
public EstimateApiController(ApplicationDbContext context, ILoggerFactory loggerFactory)
|
public EstimateApiController(ApplicationDbContext context, ILoggerFactory loggerFactory)
|
||||||
{
|
{
|
||||||
_context = context;
|
_context = context;
|
||||||
@ -28,21 +28,21 @@ namespace Yavsc.Controllers
|
|||||||
if (User.IsInRole(Constants.AdminGroupName)) return true;
|
if (User.IsInRole(Constants.AdminGroupName)) return true;
|
||||||
return uid == User.GetUserId();
|
return uid == User.GetUserId();
|
||||||
}
|
}
|
||||||
bool UserIsAdminOrInThese(string oid, string uid)
|
bool UserIsAdminOrInThese (string oid, string uid)
|
||||||
{
|
{
|
||||||
if (User.IsInRole(Constants.AdminGroupName)) return true;
|
if (User.IsInRole(Constants.AdminGroupName)) return true;
|
||||||
var cuid = User.GetUserId();
|
var cuid = User.GetUserId();
|
||||||
return cuid == uid || cuid == oid;
|
return cuid == uid || cuid == oid;
|
||||||
}
|
}
|
||||||
// GET: api/Estimate{?ownerId=User.GetUserId()}
|
// GET: api/Estimate{?ownerId=User.GetUserId()}
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult GetEstimates(string ownerId = null)
|
public IActionResult GetEstimates(string ownerId=null)
|
||||||
{
|
{
|
||||||
if (ownerId == null) ownerId = User.GetUserId();
|
if ( ownerId == null ) ownerId = User.GetUserId();
|
||||||
else if (!UserIsAdminOrThis(ownerId)) // throw new Exception("Not authorized") ;
|
else if (!UserIsAdminOrThis(ownerId)) // throw new Exception("Not authorized") ;
|
||||||
// or just do nothing
|
// or just do nothing
|
||||||
return new HttpStatusCodeResult(StatusCodes.Status403Forbidden);
|
return new HttpStatusCodeResult(StatusCodes.Status403Forbidden);
|
||||||
return Ok(_context.Estimates.Include(e => e.Bill).Where(e => e.OwnerId == ownerId));
|
return Ok(_context.Estimates.Include(e=>e.Bill).Where(e=>e.OwnerId == ownerId));
|
||||||
}
|
}
|
||||||
// GET: api/Estimate/5
|
// GET: api/Estimate/5
|
||||||
[HttpGet("{id}", Name = "GetEstimate")]
|
[HttpGet("{id}", Name = "GetEstimate")]
|
||||||
@ -53,20 +53,20 @@ namespace Yavsc.Controllers
|
|||||||
return HttpBadRequest(ModelState);
|
return HttpBadRequest(ModelState);
|
||||||
}
|
}
|
||||||
|
|
||||||
Estimate estimate = _context.Estimates.Include(e => e.Bill).Single(m => m.Id == id);
|
Estimate estimate = _context.Estimates.Include(e=>e.Bill).Single(m => m.Id == id);
|
||||||
|
|
||||||
if (estimate == null)
|
if (estimate == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UserIsAdminOrInThese(estimate.ClientId, estimate.OwnerId))
|
if (UserIsAdminOrInThese(estimate.ClientId,estimate.OwnerId))
|
||||||
return Ok(estimate);
|
return Ok(estimate);
|
||||||
return new HttpStatusCodeResult(StatusCodes.Status403Forbidden);
|
return new HttpStatusCodeResult(StatusCodes.Status403Forbidden);
|
||||||
}
|
}
|
||||||
|
|
||||||
// PUT: api/Estimate/5
|
// PUT: api/Estimate/5
|
||||||
[HttpPut("{id}"), Produces("application/json")]
|
[HttpPut("{id}"),Produces("application/json")]
|
||||||
public IActionResult PutEstimate(long id, [FromBody] Estimate estimate)
|
public IActionResult PutEstimate(long id, [FromBody] Estimate estimate)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -84,11 +84,11 @@ namespace Yavsc.Controllers
|
|||||||
{
|
{
|
||||||
if (uid != estimate.OwnerId)
|
if (uid != estimate.OwnerId)
|
||||||
{
|
{
|
||||||
ModelState.AddModelError("OwnerId", "You can only modify your own estimates");
|
ModelState.AddModelError("OwnerId","You can only modify your own estimates");
|
||||||
return HttpBadRequest(ModelState);
|
return HttpBadRequest(ModelState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var entry = _context.Attach(estimate);
|
var entry = _context.Attach(estimate);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -106,30 +106,27 @@ namespace Yavsc.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Ok(new { estimate.Id });
|
return Ok( new { Id = estimate.Id });
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: api/Estimate
|
// POST: api/Estimate
|
||||||
[HttpPost, Produces("application/json")]
|
[HttpPost,Produces("application/json")]
|
||||||
public IActionResult PostEstimate([FromBody] Estimate estimate)
|
public IActionResult PostEstimate([FromBody] Estimate estimate)
|
||||||
{
|
{
|
||||||
var uid = User.GetUserId();
|
var uid = User.GetUserId();
|
||||||
if (estimate.OwnerId == null) estimate.OwnerId = uid;
|
if (estimate.OwnerId==null) estimate.OwnerId = uid;
|
||||||
|
|
||||||
if (!User.IsInRole(Constants.AdminGroupName))
|
if (!User.IsInRole(Constants.AdminGroupName)) {
|
||||||
{
|
|
||||||
if (uid != estimate.OwnerId)
|
if (uid != estimate.OwnerId)
|
||||||
{
|
{
|
||||||
ModelState.AddModelError("OwnerId", "You can only create your own estimates");
|
ModelState.AddModelError("OwnerId","You can only create your own estimates");
|
||||||
return HttpBadRequest(ModelState);
|
return HttpBadRequest(ModelState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (estimate.CommandId != null)
|
if (estimate.CommandId!=null) {
|
||||||
{
|
|
||||||
var query = _context.RdvQueries.FirstOrDefault(q => q.Id == estimate.CommandId);
|
var query = _context.RdvQueries.FirstOrDefault(q => q.Id == estimate.CommandId);
|
||||||
if (query == null)
|
if (query == null) {
|
||||||
{
|
|
||||||
return HttpBadRequest(ModelState);
|
return HttpBadRequest(ModelState);
|
||||||
}
|
}
|
||||||
query.ValidationDate = DateTime.Now;
|
query.ValidationDate = DateTime.Now;
|
||||||
@ -139,18 +136,18 @@ namespace Yavsc.Controllers
|
|||||||
if (!ModelState.IsValid)
|
if (!ModelState.IsValid)
|
||||||
{
|
{
|
||||||
_logger.LogError(JsonConvert.SerializeObject(ModelState));
|
_logger.LogError(JsonConvert.SerializeObject(ModelState));
|
||||||
return Json(ModelState);
|
return Json(ModelState);
|
||||||
}
|
}
|
||||||
_context.Estimates.Add(estimate);
|
_context.Estimates.Add(estimate);
|
||||||
|
|
||||||
|
|
||||||
/* _context.AttachRange(estimate.Bill);
|
/* _context.AttachRange(estimate.Bill);
|
||||||
_context.Attach(estimate);
|
_context.Attach(estimate);
|
||||||
_context.Entry(estimate).State = EntityState.Added;
|
_context.Entry(estimate).State = EntityState.Added;
|
||||||
foreach (var line in estimate.Bill)
|
foreach (var line in estimate.Bill)
|
||||||
_context.Entry(line).State = EntityState.Added;
|
_context.Entry(line).State = EntityState.Added;
|
||||||
// foreach (var l in estimate.Bill) _context.Attach<CommandLine>(l);
|
// foreach (var l in estimate.Bill) _context.Attach<CommandLine>(l);
|
||||||
*/
|
*/
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_context.SaveChanges(User.GetUserId());
|
_context.SaveChanges(User.GetUserId());
|
||||||
@ -166,7 +163,7 @@ namespace Yavsc.Controllers
|
|||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Ok(new { estimate.Id, estimate.Bill });
|
return Ok( new { Id = estimate.Id, Bill = estimate.Bill });
|
||||||
}
|
}
|
||||||
|
|
||||||
// DELETE: api/Estimate/5
|
// DELETE: api/Estimate/5
|
||||||
@ -178,8 +175,8 @@ namespace Yavsc.Controllers
|
|||||||
return HttpBadRequest(ModelState);
|
return HttpBadRequest(ModelState);
|
||||||
}
|
}
|
||||||
|
|
||||||
Estimate estimate = _context.Estimates.Include(e => e.Bill).Single(m => m.Id == id);
|
Estimate estimate = _context.Estimates.Include(e=>e.Bill).Single(m => m.Id == id);
|
||||||
|
|
||||||
if (estimate == null)
|
if (estimate == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
@ -189,7 +186,7 @@ namespace Yavsc.Controllers
|
|||||||
{
|
{
|
||||||
if (uid != estimate.OwnerId)
|
if (uid != estimate.OwnerId)
|
||||||
{
|
{
|
||||||
ModelState.AddModelError("OwnerId", "You can only create your own estimates");
|
ModelState.AddModelError("OwnerId","You can only create your own estimates");
|
||||||
return HttpBadRequest(ModelState);
|
return HttpBadRequest(ModelState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -198,8 +195,8 @@ namespace Yavsc.Controllers
|
|||||||
|
|
||||||
return Ok(estimate);
|
return Ok(estimate);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool disposing)
|
protected override void Dispose (bool disposing)
|
||||||
{
|
{
|
||||||
if (disposing)
|
if (disposing)
|
||||||
{
|
{
|
||||||
@ -213,4 +210,4 @@ namespace Yavsc.Controllers
|
|||||||
return _context.Estimates.Count(e => e.Id == id) > 0;
|
return _context.Estimates.Count(e => e.Id == id) > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -9,10 +9,9 @@ using Yavsc.ViewModels.FrontOffice;
|
|||||||
namespace Yavsc.ApiControllers
|
namespace Yavsc.ApiControllers
|
||||||
{
|
{
|
||||||
[Route("api/front")]
|
[Route("api/front")]
|
||||||
public class FrontOfficeApiController : Controller
|
public class FrontOfficeApiController: Controller
|
||||||
{
|
{
|
||||||
ApplicationDbContext dbContext;
|
ApplicationDbContext dbContext;
|
||||||
|
|
||||||
private IBillingService billing;
|
private IBillingService billing;
|
||||||
|
|
||||||
public FrontOfficeApiController(ApplicationDbContext context, IBillingService billing)
|
public FrontOfficeApiController(ApplicationDbContext context, IBillingService billing)
|
||||||
@ -21,19 +20,19 @@ namespace Yavsc.ApiControllers
|
|||||||
this.billing = billing;
|
this.billing = billing;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("profiles/{actCode}")]
|
[HttpGet("profiles/{actCode}")]
|
||||||
IEnumerable<PerformerProfileViewModel> Profiles(string actCode)
|
IEnumerable<PerformerProfileViewModel> Profiles (string actCode)
|
||||||
{
|
{
|
||||||
return dbContext.ListPerformers(billing, actCode);
|
return dbContext.ListPerformers(billing, actCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("query/reject")]
|
[HttpPost("query/reject")]
|
||||||
public IActionResult RejectQuery(string billingCode, long queryId)
|
public IActionResult RejectQuery (string billingCode, long queryId)
|
||||||
{
|
{
|
||||||
if (billingCode == null) return HttpBadRequest("billingCode");
|
if (billingCode==null) return HttpBadRequest("billingCode");
|
||||||
if (queryId == 0) return HttpBadRequest("queryId");
|
if (queryId==0) return HttpBadRequest("queryId");
|
||||||
var billing = BillingService.GetBillable(dbContext, billingCode, queryId);
|
var billing = BillingService.GetBillable(dbContext, billingCode, queryId);
|
||||||
if (billing == null) return HttpBadRequest();
|
if (billing==null) return HttpBadRequest();
|
||||||
billing.Rejected = true;
|
billing.Rejected = true;
|
||||||
billing.RejectedAt = DateTime.Now;
|
billing.RejectedAt = DateTime.Now;
|
||||||
dbContext.SaveChanges();
|
dbContext.SaveChanges();
|
||||||
|
@ -11,8 +11,8 @@ namespace Yavsc.ApiControllers
|
|||||||
[Route("api/payment")]
|
[Route("api/payment")]
|
||||||
public class PaymentApiController : Controller
|
public class PaymentApiController : Controller
|
||||||
{
|
{
|
||||||
private readonly ApplicationDbContext dbContext;
|
private ApplicationDbContext dbContext;
|
||||||
private readonly SiteSettings siteSettings;
|
private SiteSettings siteSettings;
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
public PaymentApiController(
|
public PaymentApiController(
|
||||||
ApplicationDbContext dbContext,
|
ApplicationDbContext dbContext,
|
||||||
|
@ -16,7 +16,7 @@ namespace Yavsc.Controllers
|
|||||||
public class PerformersApiController : Controller
|
public class PerformersApiController : Controller
|
||||||
{
|
{
|
||||||
ApplicationDbContext dbContext;
|
ApplicationDbContext dbContext;
|
||||||
private readonly IBillingService billing;
|
private IBillingService billing;
|
||||||
|
|
||||||
public PerformersApiController(ApplicationDbContext context, IBillingService billing)
|
public PerformersApiController(ApplicationDbContext context, IBillingService billing)
|
||||||
{
|
{
|
||||||
|
@ -14,7 +14,7 @@ namespace Yavsc.Controllers
|
|||||||
[Route("api/ProductApi")]
|
[Route("api/ProductApi")]
|
||||||
public class ProductApiController : Controller
|
public class ProductApiController : Controller
|
||||||
{
|
{
|
||||||
private readonly ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
public ProductApiController(ApplicationDbContext context)
|
public ProductApiController(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
@ -146,4 +146,4 @@ namespace Yavsc.Controllers
|
|||||||
return _context.Products.Count(e => e.Id == id) > 0;
|
return _context.Products.Count(e => e.Id == id) > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -15,7 +15,7 @@ namespace Yavsc.Controllers
|
|||||||
[Route("api/dimiss")]
|
[Route("api/dimiss")]
|
||||||
public class DimissClicksApiController : Controller
|
public class DimissClicksApiController : Controller
|
||||||
{
|
{
|
||||||
private readonly ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
public DimissClicksApiController(ApplicationDbContext context)
|
public DimissClicksApiController(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
@ -174,4 +174,4 @@ namespace Yavsc.Controllers
|
|||||||
return _context.DimissClicked.Count(e => e.UserId == id) > 0;
|
return _context.DimissClicked.Count(e => e.UserId == id) > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -16,7 +16,7 @@ namespace Yavsc.Controllers
|
|||||||
[Authorize]
|
[Authorize]
|
||||||
public class FileCircleApiController : Controller
|
public class FileCircleApiController : Controller
|
||||||
{
|
{
|
||||||
private readonly ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
public FileCircleApiController(ApplicationDbContext context)
|
public FileCircleApiController(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
@ -185,4 +185,4 @@ namespace Yavsc.Controllers
|
|||||||
return _context.CircleAuthorizationToFile.Count(e => e.CircleId == id) > 0;
|
return _context.CircleAuthorizationToFile.Count(e => e.CircleId == id) > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,7 +14,7 @@ namespace Yavsc.Controllers
|
|||||||
[Route("api/bursherprofiles")]
|
[Route("api/bursherprofiles")]
|
||||||
public class BursherProfilesApiController : Controller
|
public class BursherProfilesApiController : Controller
|
||||||
{
|
{
|
||||||
private readonly ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
public BursherProfilesApiController(ApplicationDbContext context)
|
public BursherProfilesApiController(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
|
@ -26,12 +26,37 @@ namespace Yavsc.ApiControllers
|
|||||||
[Route("api/haircut")]
|
[Route("api/haircut")]
|
||||||
public class HairCutController : Controller
|
public class HairCutController : Controller
|
||||||
{
|
{
|
||||||
private readonly ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
private readonly ILogger _logger;
|
private IEmailSender _emailSender;
|
||||||
|
private IYavscMessageSender _GCMSender;
|
||||||
|
private GoogleAuthSettings _googleSettings;
|
||||||
|
private IStringLocalizer<YavscLocalisation> _localizer;
|
||||||
|
private ILogger _logger;
|
||||||
|
private SiteSettings _siteSettings;
|
||||||
|
private SmtpSettings _smtpSettings;
|
||||||
|
private UserManager<ApplicationUser> _userManager;
|
||||||
|
|
||||||
|
PayPalSettings _paymentSettings;
|
||||||
public HairCutController(ApplicationDbContext context,
|
public HairCutController(ApplicationDbContext context,
|
||||||
|
IOptions<GoogleAuthSettings> googleSettings,
|
||||||
|
IYavscMessageSender GCMSender,
|
||||||
|
UserManager<ApplicationUser> userManager,
|
||||||
|
IStringLocalizer<Yavsc.YavscLocalisation> localizer,
|
||||||
|
IEmailSender emailSender,
|
||||||
|
IOptions<SmtpSettings> smtpSettings,
|
||||||
|
IOptions<SiteSettings> siteSettings,
|
||||||
|
IOptions<PayPalSettings> payPalSettings,
|
||||||
ILoggerFactory loggerFactory)
|
ILoggerFactory loggerFactory)
|
||||||
{
|
{
|
||||||
_context = context;
|
_context = context;
|
||||||
|
_GCMSender = GCMSender;
|
||||||
|
_emailSender = emailSender;
|
||||||
|
_googleSettings = googleSettings.Value;
|
||||||
|
_userManager = userManager;
|
||||||
|
_smtpSettings = smtpSettings.Value;
|
||||||
|
_siteSettings = siteSettings.Value;
|
||||||
|
_paymentSettings = payPalSettings.Value;
|
||||||
|
_localizer = localizer;
|
||||||
_logger = loggerFactory.CreateLogger<HairCutController>();
|
_logger = loggerFactory.CreateLogger<HairCutController>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
namespace Yavsc.ApiControllers
|
namespace Yavsc.ApiControllers
|
||||||
{
|
{
|
||||||
using Models;
|
using Models;
|
||||||
using Yavsc.Models.Musical.Profiles;
|
using Models.Musical.Profiles;
|
||||||
|
|
||||||
public class DjProfileApiController : ProfileApiController<DjSettings>
|
public class DjProfileApiController : ProfileApiController<DjSettings>
|
||||||
{
|
{
|
||||||
public DjProfileApiController() : base()
|
public DjProfileApiController(ApplicationDbContext context) : base(context)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -13,7 +13,7 @@ namespace Yavsc.Controllers
|
|||||||
[Route("api/museprefs")]
|
[Route("api/museprefs")]
|
||||||
public class MusicalPreferencesApiController : Controller
|
public class MusicalPreferencesApiController : Controller
|
||||||
{
|
{
|
||||||
private readonly ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
public MusicalPreferencesApiController(ApplicationDbContext context)
|
public MusicalPreferencesApiController(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
|
@ -13,7 +13,7 @@ namespace Yavsc.Controllers
|
|||||||
[Route("api/MusicalTendenciesApi")]
|
[Route("api/MusicalTendenciesApi")]
|
||||||
public class MusicalTendenciesApiController : Controller
|
public class MusicalTendenciesApiController : Controller
|
||||||
{
|
{
|
||||||
private readonly ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
public MusicalTendenciesApiController(ApplicationDbContext context)
|
public MusicalTendenciesApiController(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
@ -145,4 +145,4 @@ namespace Yavsc.Controllers
|
|||||||
return _context.MusicalTendency.Count(e => e.Id == id) > 0;
|
return _context.MusicalTendency.Count(e => e.Id == id) > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -11,8 +11,8 @@ using Yavsc.Models.Identity;
|
|||||||
[Authorize, Route("~/api/gcm")]
|
[Authorize, Route("~/api/gcm")]
|
||||||
public class NativeConfidentialController : Controller
|
public class NativeConfidentialController : Controller
|
||||||
{
|
{
|
||||||
readonly ILogger _logger;
|
ILogger _logger;
|
||||||
readonly ApplicationDbContext _context;
|
ApplicationDbContext _context;
|
||||||
|
|
||||||
public NativeConfidentialController(ApplicationDbContext context,
|
public NativeConfidentialController(ApplicationDbContext context,
|
||||||
ILoggerFactory loggerFactory)
|
ILoggerFactory loggerFactory)
|
||||||
|
@ -10,7 +10,7 @@ namespace Yavsc.Controllers
|
|||||||
[Route("~/api/PostRateApi")]
|
[Route("~/api/PostRateApi")]
|
||||||
public class PostRateApiController : Controller
|
public class PostRateApiController : Controller
|
||||||
{
|
{
|
||||||
private readonly ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
public PostRateApiController(ApplicationDbContext context)
|
public PostRateApiController(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
|
@ -9,9 +9,12 @@ namespace Yavsc.ApiControllers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[Produces("application/json"),Route("api/profile")]
|
[Produces("application/json"),Route("api/profile")]
|
||||||
public abstract class ProfileApiController<T> : Controller
|
public abstract class ProfileApiController<T> : Controller
|
||||||
{ public ProfileApiController()
|
{
|
||||||
|
ApplicationDbContext dbContext;
|
||||||
|
public ProfileApiController(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
|
dbContext = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,7 +14,7 @@ namespace Yavsc.Controllers
|
|||||||
[Route("api/blacklist"), Authorize]
|
[Route("api/blacklist"), Authorize]
|
||||||
public class BlackListApiController : Controller
|
public class BlackListApiController : Controller
|
||||||
{
|
{
|
||||||
private readonly ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
public BlackListApiController(ApplicationDbContext context)
|
public BlackListApiController(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
@ -162,4 +162,4 @@ namespace Yavsc.Controllers
|
|||||||
return _context.BlackListed.Count(e => e.Id == id) > 0;
|
return _context.BlackListed.Count(e => e.Id == id) > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,7 +14,7 @@ namespace Yavsc.Controllers
|
|||||||
[Route("api/blogacl")]
|
[Route("api/blogacl")]
|
||||||
public class BlogAclApiController : Controller
|
public class BlogAclApiController : Controller
|
||||||
{
|
{
|
||||||
private readonly ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
public BlogAclApiController(ApplicationDbContext context)
|
public BlogAclApiController(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
@ -164,4 +164,4 @@ namespace Yavsc.Controllers
|
|||||||
return _context.CircleAuthorizationToBlogPost.Count(e => e.CircleId == id) > 0;
|
return _context.CircleAuthorizationToBlogPost.Count(e => e.CircleId == id) > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -15,9 +15,9 @@ namespace Yavsc.Controllers
|
|||||||
[Route("api/chat")]
|
[Route("api/chat")]
|
||||||
public class ChatApiController : Controller
|
public class ChatApiController : Controller
|
||||||
{
|
{
|
||||||
readonly ApplicationDbContext dbContext;
|
ApplicationDbContext dbContext;
|
||||||
readonly UserManager<ApplicationUser> userManager;
|
UserManager<ApplicationUser> userManager;
|
||||||
private readonly IConnexionManager _cxManager;
|
private IConnexionManager _cxManager;
|
||||||
public ChatApiController(ApplicationDbContext dbContext,
|
public ChatApiController(ApplicationDbContext dbContext,
|
||||||
UserManager<ApplicationUser> userManager,
|
UserManager<ApplicationUser> userManager,
|
||||||
IConnexionManager cxManager)
|
IConnexionManager cxManager)
|
||||||
|
@ -15,7 +15,7 @@ namespace Yavsc.Controllers
|
|||||||
[Route("api/ChatRoomAccessApi")]
|
[Route("api/ChatRoomAccessApi")]
|
||||||
public class ChatRoomAccessApiController : Controller
|
public class ChatRoomAccessApiController : Controller
|
||||||
{
|
{
|
||||||
private readonly ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
public ChatRoomAccessApiController(ApplicationDbContext context)
|
public ChatRoomAccessApiController(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
@ -183,4 +183,4 @@ namespace Yavsc.Controllers
|
|||||||
return _context.ChatRoomAccess.Count(e => e.ChannelName == id) > 0;
|
return _context.ChatRoomAccess.Count(e => e.ChannelName == id) > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,7 +14,7 @@ namespace Yavsc.Controllers
|
|||||||
[Route("api/ChatRoomApi")]
|
[Route("api/ChatRoomApi")]
|
||||||
public class ChatRoomApiController : Controller
|
public class ChatRoomApiController : Controller
|
||||||
{
|
{
|
||||||
private readonly ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
public ChatRoomApiController(ApplicationDbContext context)
|
public ChatRoomApiController(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
@ -164,4 +164,4 @@ namespace Yavsc.Controllers
|
|||||||
return _context.ChatRoom.Count(e => e.Name == id) > 0;
|
return _context.ChatRoom.Count(e => e.Name == id) > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,7 +14,7 @@ namespace Yavsc.Controllers
|
|||||||
[Route("api/cirle")]
|
[Route("api/cirle")]
|
||||||
public class CircleApiController : Controller
|
public class CircleApiController : Controller
|
||||||
{
|
{
|
||||||
private readonly ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
public CircleApiController(ApplicationDbContext context)
|
public CircleApiController(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
@ -146,4 +146,4 @@ namespace Yavsc.Controllers
|
|||||||
return _context.Circle.Count(e => e.Id == id) > 0;
|
return _context.Circle.Count(e => e.Id == id) > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -12,7 +12,7 @@ namespace Yavsc.Controllers
|
|||||||
[Route("api/ContactsApi")]
|
[Route("api/ContactsApi")]
|
||||||
public class ContactsApiController : Controller
|
public class ContactsApiController : Controller
|
||||||
{
|
{
|
||||||
private readonly ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
public ContactsApiController(ApplicationDbContext context)
|
public ContactsApiController(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
@ -125,4 +125,4 @@ namespace Yavsc.Controllers
|
|||||||
return _context.ClientProviderInfo.Count(e => e.UserId == id) > 0;
|
return _context.ClientProviderInfo.Count(e => e.UserId == id) > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,7 +14,7 @@ namespace Yavsc.Controllers
|
|||||||
[Route("api/ServiceApi")]
|
[Route("api/ServiceApi")]
|
||||||
public class ServiceApiController : Controller
|
public class ServiceApiController : Controller
|
||||||
{
|
{
|
||||||
private readonly ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
public ServiceApiController(ApplicationDbContext context)
|
public ServiceApiController(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
@ -146,4 +146,4 @@ namespace Yavsc.Controllers
|
|||||||
return _context.Services.Count(e => e.Id == id) > 0;
|
return _context.Services.Count(e => e.Id == id) > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
|
using System.Collections.Concurrent;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net.WebSockets;
|
using System.Net.WebSockets;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
@ -7,17 +7,21 @@ using System.Threading.Tasks;
|
|||||||
using Microsoft.AspNet.Http;
|
using Microsoft.AspNet.Http;
|
||||||
using Microsoft.AspNet.Mvc;
|
using Microsoft.AspNet.Mvc;
|
||||||
using Microsoft.Data.Entity;
|
using Microsoft.Data.Entity;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Streaming;
|
using Yavsc.Models.Streaming;
|
||||||
using Yavsc.Services;
|
using Yavsc.Services;
|
||||||
|
using Yavsc.ViewModels.Streaming;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
[Route("api/live")]
|
[Route("api/live")]
|
||||||
public class LiveApiController : Controller
|
public class LiveApiController : Controller
|
||||||
{
|
{
|
||||||
readonly ILiveProcessor _liveProcessor;
|
|
||||||
private readonly ApplicationDbContext _dbContext;
|
ILiveProcessor _liveProcessor;
|
||||||
|
private ApplicationDbContext _dbContext;
|
||||||
|
ILogger _logger;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Live Api Controller
|
/// Live Api Controller
|
||||||
@ -26,11 +30,13 @@ namespace Yavsc.Controllers
|
|||||||
/// <param name="context"></param>
|
/// <param name="context"></param>
|
||||||
|
|
||||||
public LiveApiController(
|
public LiveApiController(
|
||||||
|
ILoggerFactory loggerFactory,
|
||||||
ApplicationDbContext context,
|
ApplicationDbContext context,
|
||||||
ILiveProcessor liveProcessor)
|
ILiveProcessor liveProcessor)
|
||||||
{
|
{
|
||||||
_liveProcessor = liveProcessor;
|
_liveProcessor = liveProcessor;
|
||||||
_dbContext = context;
|
_dbContext = context;
|
||||||
|
_logger = loggerFactory.CreateLogger<LiveApiController>();
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("filenamehint/{id}")]
|
[HttpGet("filenamehint/{id}")]
|
||||||
|
@ -16,8 +16,8 @@ namespace Yavsc.ApiControllers
|
|||||||
[Route("~/api/bug")]
|
[Route("~/api/bug")]
|
||||||
public class BugApiController : Controller
|
public class BugApiController : Controller
|
||||||
{
|
{
|
||||||
private readonly ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
readonly ILogger _logger;
|
ILogger _logger;
|
||||||
|
|
||||||
public BugApiController(ApplicationDbContext context, ILoggerFactory factory)
|
public BugApiController(ApplicationDbContext context, ILoggerFactory factory)
|
||||||
{
|
{
|
||||||
|
@ -22,8 +22,9 @@ namespace Yavsc.WebApi.Controllers
|
|||||||
|
|
||||||
private UserManager<ApplicationUser> _userManager;
|
private UserManager<ApplicationUser> _userManager;
|
||||||
private readonly SignInManager<ApplicationUser> _signInManager;
|
private readonly SignInManager<ApplicationUser> _signInManager;
|
||||||
readonly ApplicationDbContext _dbContext;
|
|
||||||
private readonly ILogger _logger;
|
ApplicationDbContext _dbContext;
|
||||||
|
private ILogger _logger;
|
||||||
|
|
||||||
public ApiAccountController(UserManager<ApplicationUser> userManager,
|
public ApiAccountController(UserManager<ApplicationUser> userManager,
|
||||||
SignInManager<ApplicationUser> signInManager, ILoggerFactory loggerFactory, ApplicationDbContext dbContext)
|
SignInManager<ApplicationUser> signInManager, ILoggerFactory loggerFactory, ApplicationDbContext dbContext)
|
||||||
|
@ -14,7 +14,7 @@ namespace Yavsc.Controllers
|
|||||||
[Route("api/users")]
|
[Route("api/users")]
|
||||||
public class ApplicationUserApiController : Controller
|
public class ApplicationUserApiController : Controller
|
||||||
{
|
{
|
||||||
private readonly ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
public ApplicationUserApiController(ApplicationDbContext context)
|
public ApplicationUserApiController(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
|
@ -11,8 +11,8 @@ namespace Yavsc.ApiControllers.accounting
|
|||||||
[Route("~/api/profile")]
|
[Route("~/api/profile")]
|
||||||
public class ProfileApiController: Controller
|
public class ProfileApiController: Controller
|
||||||
{
|
{
|
||||||
readonly UserManager<ApplicationUser> _userManager;
|
UserManager<ApplicationUser> _userManager;
|
||||||
readonly ApplicationDbContext _dbContext;
|
ApplicationDbContext _dbContext;
|
||||||
public ProfileApiController(ApplicationDbContext dbContext, UserManager<ApplicationUser> userManager)
|
public ProfileApiController(ApplicationDbContext dbContext, UserManager<ApplicationUser> userManager)
|
||||||
{
|
{
|
||||||
_dbContext = dbContext;
|
_dbContext = dbContext;
|
||||||
@ -36,4 +36,4 @@ namespace Yavsc.ApiControllers.accounting
|
|||||||
.Take(10).ToArray();
|
.Take(10).ToArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -32,4 +32,4 @@ namespace Yavsc.AuthorizationHandlers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -8,7 +8,7 @@ namespace Yavsc.AuthorizationHandlers
|
|||||||
{
|
{
|
||||||
public class SendMessageHandler : AuthorizationHandler<PrivateChatEntryRequirement, string>
|
public class SendMessageHandler : AuthorizationHandler<PrivateChatEntryRequirement, string>
|
||||||
{
|
{
|
||||||
readonly ApplicationDbContext _dbContext ;
|
ApplicationDbContext _dbContext ;
|
||||||
|
|
||||||
public SendMessageHandler(ApplicationDbContext dbContext)
|
public SendMessageHandler(ApplicationDbContext dbContext)
|
||||||
{
|
{
|
||||||
|
@ -1,38 +1,31 @@
|
|||||||
using Microsoft.AspNet.Authorization;
|
using Microsoft.AspNet.Authorization;
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
using Yavsc.Services;
|
using Yavsc.Services;
|
||||||
using Yavsc.ViewModels.Auth;
|
using Yavsc.ViewModels.Auth;
|
||||||
|
|
||||||
namespace Yavsc.AuthorizationHandlers
|
namespace Yavsc.AuthorizationHandlers {
|
||||||
{
|
|
||||||
|
|
||||||
public class ViewFileHandler : AuthorizationHandler<ViewRequirement, ViewFileContext>
|
public class ViewFileHandler : AuthorizationHandler<ViewRequirement, ViewFileContext> {
|
||||||
{
|
|
||||||
readonly IFileSystemAuthManager _authManager;
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
|
|
||||||
public ViewFileHandler(IFileSystemAuthManager authManager, ILoggerFactory logFactory)
|
IFileSystemAuthManager _authManager;
|
||||||
{
|
|
||||||
|
public ViewFileHandler (IFileSystemAuthManager authManager) {
|
||||||
_authManager = authManager;
|
_authManager = authManager;
|
||||||
_logger = logFactory.CreateLogger<ViewFileHandler>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Handle(AuthorizationContext context, ViewRequirement requirement, ViewFileContext fileContext)
|
protected override void Handle (AuthorizationContext context, ViewRequirement requirement, ViewFileContext fileContext) {
|
||||||
{
|
// TODO file access rules
|
||||||
|
if (fileContext.Path.StartsWith ("/pub/"))
|
||||||
var rights = _authManager.GetFilePathAccess(context.User, fileContext.File);
|
context.Succeed (requirement);
|
||||||
_logger.LogInformation("Got access value : " + rights);
|
else {
|
||||||
if ((rights & FileAccessRight.Read) > 0)
|
if (!fileContext.Path.StartsWith ("/"))
|
||||||
{
|
context.Fail ();
|
||||||
_logger.LogInformation("Allowing access");
|
else {
|
||||||
context.Succeed(requirement);
|
var rights = _authManager.GetFilePathAccess (context.User, fileContext.Path);
|
||||||
}
|
if ((rights & FileAccessRight.Read) > 0)
|
||||||
else
|
context.Succeed (requirement);
|
||||||
{
|
else context.Fail ();
|
||||||
_logger.LogInformation("Denying access");
|
}
|
||||||
context.Fail();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -15,7 +15,7 @@ namespace Yavsc.Auth
|
|||||||
{
|
{
|
||||||
internal class GoogleHandler : OAuthHandler<YavscGoogleOptions>
|
internal class GoogleHandler : OAuthHandler<YavscGoogleOptions>
|
||||||
{
|
{
|
||||||
private readonly ILogger _logger;
|
private ILogger _logger;
|
||||||
public GoogleHandler(HttpClient httpClient,ILogger logger)
|
public GoogleHandler(HttpClient httpClient,ILogger logger)
|
||||||
: base(httpClient)
|
: base(httpClient)
|
||||||
{
|
{
|
||||||
@ -92,11 +92,9 @@ namespace Yavsc.Auth
|
|||||||
{
|
{
|
||||||
|
|
||||||
var scope = FormatScope();
|
var scope = FormatScope();
|
||||||
var queryStrings = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
|
var queryStrings = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||||
{
|
queryStrings.Add("response_type", "code");
|
||||||
{ "response_type", "code" },
|
queryStrings.Add("client_id", Options.ClientId);
|
||||||
{ "client_id", Options.ClientId }
|
|
||||||
};
|
|
||||||
// this runtime may not known this value,
|
// this runtime may not known this value,
|
||||||
// it should be get from config,
|
// it should be get from config,
|
||||||
// And always be using a secure sheme ... since Google won't support anymore insecure ones.
|
// And always be using a secure sheme ... since Google won't support anymore insecure ones.
|
||||||
|
@ -16,7 +16,8 @@ namespace Yavsc.Auth
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class GoogleMiddleware : OAuthMiddleware<YavscGoogleOptions>
|
public class GoogleMiddleware : OAuthMiddleware<YavscGoogleOptions>
|
||||||
{
|
{
|
||||||
private readonly ILogger _logger;
|
private RequestDelegate _next;
|
||||||
|
private ILogger _logger;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new <see cref="GoogleMiddleware"/>.
|
/// Initializes a new <see cref="GoogleMiddleware"/>.
|
||||||
@ -36,6 +37,11 @@ namespace Yavsc.Auth
|
|||||||
YavscGoogleOptions options)
|
YavscGoogleOptions options)
|
||||||
: base(next, dataProtectionProvider, loggerFactory, encoder, sharedOptions, options)
|
: base(next, dataProtectionProvider, loggerFactory, encoder, sharedOptions, options)
|
||||||
{
|
{
|
||||||
|
if (next == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(next));
|
||||||
|
}
|
||||||
|
_next = next;
|
||||||
|
|
||||||
if (dataProtectionProvider == null)
|
if (dataProtectionProvider == null)
|
||||||
{
|
{
|
||||||
|
@ -15,9 +15,8 @@ namespace Yavsc.Auth {
|
|||||||
_googleUserId = googleUserId;
|
_googleUserId = googleUserId;
|
||||||
Principal = ticket.Principal;
|
Principal = ticket.Principal;
|
||||||
}
|
}
|
||||||
|
AuthenticationTicket _ticket;
|
||||||
readonly AuthenticationTicket _ticket;
|
string _googleUserId;
|
||||||
readonly string _googleUserId;
|
|
||||||
|
|
||||||
public AuthenticationTicket Ticket { get { return _ticket; } }
|
public AuthenticationTicket Ticket { get { return _ticket; } }
|
||||||
|
|
||||||
@ -25,4 +24,4 @@ namespace Yavsc.Auth {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -12,8 +12,10 @@ namespace Yavsc.Auth
|
|||||||
public class MonoJwtSecurityTokenHandler : JwtSecurityTokenHandler
|
public class MonoJwtSecurityTokenHandler : JwtSecurityTokenHandler
|
||||||
{
|
{
|
||||||
|
|
||||||
public MonoJwtSecurityTokenHandler()
|
MonoDataProtectionProvider protectionProvider;
|
||||||
|
public MonoJwtSecurityTokenHandler(MonoDataProtectionProvider prpro)
|
||||||
{
|
{
|
||||||
|
protectionProvider = prpro;
|
||||||
}
|
}
|
||||||
public override JwtSecurityToken CreateToken(
|
public override JwtSecurityToken CreateToken(
|
||||||
string issuer,
|
string issuer,
|
||||||
@ -37,4 +39,4 @@ namespace Yavsc.Auth
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -10,6 +10,11 @@ namespace Yavsc.Auth {
|
|||||||
|
|
||||||
public class UserTokenProvider : Microsoft.AspNet.Identity.IUserTokenProvider<ApplicationUser>
|
public class UserTokenProvider : Microsoft.AspNet.Identity.IUserTokenProvider<ApplicationUser>
|
||||||
{
|
{
|
||||||
|
private MonoDataProtector protector=null;
|
||||||
|
public MonoDataProtector Protector {
|
||||||
|
get { return protector; }
|
||||||
|
}
|
||||||
|
|
||||||
public Task<bool> CanGenerateTwoFactorTokenAsync(UserManager<ApplicationUser> manager, ApplicationUser user)
|
public Task<bool> CanGenerateTwoFactorTokenAsync(UserManager<ApplicationUser> manager, ApplicationUser user)
|
||||||
{
|
{
|
||||||
return Task.FromResult(true);
|
return Task.FromResult(true);
|
||||||
|
@ -9,7 +9,7 @@ namespace Yavsc.Auth {
|
|||||||
|
|
||||||
public class MonoXmlEncryptor : IXmlEncryptor
|
public class MonoXmlEncryptor : IXmlEncryptor
|
||||||
{
|
{
|
||||||
public MonoXmlEncryptor ()
|
public MonoXmlEncryptor (IServiceProvider serviceProvider)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
public EncryptedXmlInfo Encrypt(XElement plaintextElement)
|
public EncryptedXmlInfo Encrypt(XElement plaintextElement)
|
||||||
@ -20,4 +20,4 @@ namespace Yavsc.Auth {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -69,8 +69,9 @@ namespace Yavsc.Controllers
|
|||||||
|
|
||||||
|
|
||||||
[Authorize(Roles = Constants.AdminGroupName)]
|
[Authorize(Roles = Constants.AdminGroupName)]
|
||||||
public IActionResult Index()
|
public IActionResult Index(string page, string len)
|
||||||
{
|
{
|
||||||
|
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,7 +262,7 @@ namespace Yavsc.Controllers
|
|||||||
// For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=532713
|
// For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=532713
|
||||||
// Send an email with this link
|
// Send an email with this link
|
||||||
var code = await _userManager.GenerateEmailConfirmationTokenAsync(user);
|
var code = await _userManager.GenerateEmailConfirmationTokenAsync(user);
|
||||||
var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code }, protocol: "https", host: Startup.Authority);
|
var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: "https", host: Startup.Authority);
|
||||||
var emailSent = await _emailSender.SendEmailAsync(model.UserName, model.Email, _localizer["ConfirmYourAccountTitle"],
|
var emailSent = await _emailSender.SendEmailAsync(model.UserName, model.Email, _localizer["ConfirmYourAccountTitle"],
|
||||||
string.Format(_localizer["ConfirmYourAccountBody"], _siteSettings.Title, callbackUrl, _siteSettings.Slogan, _siteSettings.Audience));
|
string.Format(_localizer["ConfirmYourAccountBody"], _siteSettings.Title, callbackUrl, _siteSettings.Slogan, _siteSettings.Audience));
|
||||||
// No, wait for more than a login pass submission:
|
// No, wait for more than a login pass submission:
|
||||||
@ -316,7 +317,7 @@ namespace Yavsc.Controllers
|
|||||||
{
|
{
|
||||||
var code = await _userManager.GenerateEmailConfirmationTokenAsync(user);
|
var code = await _userManager.GenerateEmailConfirmationTokenAsync(user);
|
||||||
var callbackUrl = Url.Action("ConfirmEmail", "Account",
|
var callbackUrl = Url.Action("ConfirmEmail", "Account",
|
||||||
new { userId = user.Id, code }, protocol: "https", host: Startup.Authority);
|
new { userId = user.Id, code = code }, protocol: "https", host: Startup.Authority);
|
||||||
var res = await _emailSender.SendEmailAsync(user.UserName, user.Email,
|
var res = await _emailSender.SendEmailAsync(user.UserName, user.Email,
|
||||||
this._localizer["ConfirmYourAccountTitle"],
|
this._localizer["ConfirmYourAccountTitle"],
|
||||||
string.Format(this._localizer["ConfirmYourAccountBody"],
|
string.Format(this._localizer["ConfirmYourAccountBody"],
|
||||||
@ -591,7 +592,7 @@ namespace Yavsc.Controllers
|
|||||||
// GET: /Account/ResetPassword
|
// GET: /Account/ResetPassword
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
public async Task<IActionResult> ResetPassword(string UserId)
|
public async Task<IActionResult> ResetPassword(string UserId, string code = null)
|
||||||
{
|
{
|
||||||
var user = await _userManager.FindByIdAsync(UserId);
|
var user = await _userManager.FindByIdAsync(UserId);
|
||||||
if (user==null) return new BadRequestResult();
|
if (user==null) return new BadRequestResult();
|
||||||
|
@ -29,18 +29,18 @@ namespace Yavsc.Controllers
|
|||||||
private readonly SignInManager<ApplicationUser> _signInManager;
|
private readonly SignInManager<ApplicationUser> _signInManager;
|
||||||
private readonly IEmailSender _emailSender;
|
private readonly IEmailSender _emailSender;
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly SiteSettings _siteSettings;
|
private SiteSettings _siteSettings;
|
||||||
|
|
||||||
private readonly ApplicationDbContext _dbContext;
|
private ApplicationDbContext _dbContext;
|
||||||
|
|
||||||
private readonly GoogleAuthSettings _googleSettings;
|
private GoogleAuthSettings _googleSettings;
|
||||||
|
|
||||||
private readonly PayPalSettings _payPalSettings;
|
private PayPalSettings _payPalSettings;
|
||||||
private readonly IYavscMessageSender _GCMSender;
|
private IYavscMessageSender _GCMSender;
|
||||||
private readonly SIRENChecker _cchecker;
|
private SIRENChecker _cchecker;
|
||||||
private readonly IStringLocalizer _SR;
|
private IStringLocalizer _SR;
|
||||||
private readonly CompanyInfoSettings _cinfoSettings;
|
private CompanyInfoSettings _cinfoSettings;
|
||||||
readonly ICalendarManager _calendarManager;
|
ICalendarManager _calendarManager;
|
||||||
|
|
||||||
|
|
||||||
public ManageController(
|
public ManageController(
|
||||||
@ -195,9 +195,9 @@ namespace Yavsc.Controllers
|
|||||||
// Generate the token and send it
|
// Generate the token and send it
|
||||||
var user = await GetCurrentUserAsync();
|
var user = await GetCurrentUserAsync();
|
||||||
var code = await _userManager.GenerateChangePhoneNumberTokenAsync(user, model.PhoneNumber);
|
var code = await _userManager.GenerateChangePhoneNumberTokenAsync(user, model.PhoneNumber);
|
||||||
// TODO ? await _smsSender.SendSmsAsync(_twilioSettings, model.PhoneNumber, "Your security code is: " + code);
|
// TODO await _smsSender.SendSmsAsync(_twilioSettings, model.PhoneNumber, "Your security code is: " + code);
|
||||||
|
|
||||||
return RedirectToAction(nameof(VerifyPhoneNumber), new { model.PhoneNumber });
|
return RedirectToAction(nameof(VerifyPhoneNumber), new { PhoneNumber = model.PhoneNumber });
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -300,7 +300,7 @@ namespace Yavsc.Controllers
|
|||||||
{
|
{
|
||||||
var uid = User.GetUserId();
|
var uid = User.GetUserId();
|
||||||
|
|
||||||
var calendars = await _calendarManager.GetCalendarsAsync(pageToken);
|
var calendars = await _calendarManager.GetCalendarsAsync(uid, pageToken);
|
||||||
return View(new SetGoogleCalendarViewModel {
|
return View(new SetGoogleCalendarViewModel {
|
||||||
ReturnUrl = returnUrl,
|
ReturnUrl = returnUrl,
|
||||||
Calendars = calendars
|
Calendars = calendars
|
||||||
|
@ -20,12 +20,27 @@ namespace Yavsc.Controllers
|
|||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
public class OAuthController : Controller
|
public class OAuthController : Controller
|
||||||
{
|
{
|
||||||
readonly ILogger _logger;
|
ApplicationDbContext _context;
|
||||||
|
UserManager<ApplicationUser> _userManager;
|
||||||
|
|
||||||
public OAuthController(ILoggerFactory loggerFactory)
|
SiteSettings _siteSettings;
|
||||||
|
|
||||||
|
ILogger _logger;
|
||||||
|
private readonly SignInManager<ApplicationUser> _signInManager;
|
||||||
|
|
||||||
|
public OAuthController(ApplicationDbContext context, SignInManager<ApplicationUser> signInManager, IKeyManager keyManager,
|
||||||
|
UserManager<ApplicationUser> userManager,
|
||||||
|
IOptions<SiteSettings> siteSettings,
|
||||||
|
ILoggerFactory loggerFactory
|
||||||
|
)
|
||||||
{
|
{
|
||||||
|
_siteSettings = siteSettings.Value;
|
||||||
|
_context = context;
|
||||||
|
_signInManager = signInManager;
|
||||||
|
_userManager = userManager;
|
||||||
_logger = loggerFactory.CreateLogger<OAuthController>();
|
_logger = loggerFactory.CreateLogger<OAuthController>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[HttpGet("~/api/getclaims"), Produces("application/json")]
|
[HttpGet("~/api/getclaims"), Produces("application/json")]
|
||||||
|
@ -10,7 +10,7 @@ namespace Yavsc.Controllers
|
|||||||
[Authorize("AdministratorOnly")]
|
[Authorize("AdministratorOnly")]
|
||||||
public class UsersController : Controller
|
public class UsersController : Controller
|
||||||
{
|
{
|
||||||
private readonly ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
public UsersController(ApplicationDbContext context)
|
public UsersController(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
|
@ -16,7 +16,7 @@ namespace Yavsc.Controllers
|
|||||||
[Authorize("AdministratorOnly")]
|
[Authorize("AdministratorOnly")]
|
||||||
public class MailingTemplateController : Controller
|
public class MailingTemplateController : Controller
|
||||||
{
|
{
|
||||||
private readonly ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
public MailingTemplateController(ApplicationDbContext context)
|
public MailingTemplateController(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
|
@ -13,9 +13,10 @@ namespace Yavsc.Controllers
|
|||||||
{
|
{
|
||||||
public class AnnouncesController : Controller
|
public class AnnouncesController : Controller
|
||||||
{
|
{
|
||||||
private readonly ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
readonly IStringLocalizer<AnnouncesController> _localizer;
|
IStringLocalizer<AnnouncesController> _localizer;
|
||||||
readonly IAuthorizationService _authorizationService;
|
|
||||||
|
IAuthorizationService _authorizationService;
|
||||||
|
|
||||||
public AnnouncesController(ApplicationDbContext context,
|
public AnnouncesController(ApplicationDbContext context,
|
||||||
IAuthorizationService authorizationService,
|
IAuthorizationService authorizationService,
|
||||||
@ -60,7 +61,9 @@ namespace Yavsc.Controllers
|
|||||||
{
|
{
|
||||||
ViewBag.IsAdmin = User.IsInRole(Constants.AdminGroupName);
|
ViewBag.IsAdmin = User.IsInRole(Constants.AdminGroupName);
|
||||||
ViewBag.IsPerformer = User.IsInRole(Constants.PerformerGroupName);
|
ViewBag.IsPerformer = User.IsInRole(Constants.PerformerGroupName);
|
||||||
ViewBag.AllowEdit = announce==null || announce.Id<=0 || await _authorizationService.AuthorizeAsync(User,announce,new EditRequirement());
|
ViewBag.AllowEdit = (announce!=null && announce.Id>0) ?
|
||||||
|
await _authorizationService.AuthorizeAsync(User,announce,new EditRequirement()) :
|
||||||
|
true;
|
||||||
List<SelectListItem> dl = new List<SelectListItem>();
|
List<SelectListItem> dl = new List<SelectListItem>();
|
||||||
var rnames = System.Enum.GetNames(typeof(Reason));
|
var rnames = System.Enum.GetNames(typeof(Reason));
|
||||||
var rvalues = System.Enum.GetValues(typeof(Reason));
|
var rvalues = System.Enum.GetValues(typeof(Reason));
|
||||||
|
@ -21,10 +21,11 @@ namespace Yavsc.Controllers
|
|||||||
{
|
{
|
||||||
public class BlogspotController : Controller
|
public class BlogspotController : Controller
|
||||||
{
|
{
|
||||||
readonly ILogger _logger;
|
ILogger _logger;
|
||||||
private readonly ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
private readonly IAuthorizationService _authorizationService;
|
private IAuthorizationService _authorizationService;
|
||||||
readonly RequestLocalizationOptions _localisationOptions;
|
|
||||||
|
RequestLocalizationOptions _localisationOptions;
|
||||||
|
|
||||||
public BlogspotController(
|
public BlogspotController(
|
||||||
ApplicationDbContext context,
|
ApplicationDbContext context,
|
||||||
@ -40,7 +41,7 @@ namespace Yavsc.Controllers
|
|||||||
|
|
||||||
// GET: Blog
|
// GET: Blog
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
public async Task<IActionResult> Index(string id)
|
public async Task<IActionResult> Index(string id, int skip=0, int maxLen=25)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(id)) {
|
if (!string.IsNullOrEmpty(id)) {
|
||||||
return await UserPosts(id);
|
return await UserPosts(id);
|
||||||
|
@ -11,7 +11,7 @@ namespace Yavsc.Controllers
|
|||||||
{
|
{
|
||||||
public class CircleController : Controller
|
public class CircleController : Controller
|
||||||
{
|
{
|
||||||
private readonly ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
public CircleController(ApplicationDbContext context)
|
public CircleController(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
|
@ -11,7 +11,7 @@ namespace Yavsc.Controllers
|
|||||||
{
|
{
|
||||||
public class CircleMembersController : Controller
|
public class CircleMembersController : Controller
|
||||||
{
|
{
|
||||||
private readonly ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
public CircleMembersController(ApplicationDbContext context)
|
public CircleMembersController(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
|
@ -13,7 +13,7 @@ namespace Yavsc.Controllers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class CommentsController : Controller
|
public class CommentsController : Controller
|
||||||
{
|
{
|
||||||
private readonly ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
public CommentsController(ApplicationDbContext context)
|
public CommentsController(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
|
@ -12,7 +12,7 @@ namespace Yavsc.Controllers
|
|||||||
using Models.Identity;
|
using Models.Identity;
|
||||||
public class DevicesController : Controller
|
public class DevicesController : Controller
|
||||||
{
|
{
|
||||||
private readonly ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
public DevicesController(ApplicationDbContext context)
|
public DevicesController(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
|
@ -10,7 +10,7 @@ namespace Yavsc.Controllers
|
|||||||
[Authorize("AdministratorOnly")]
|
[Authorize("AdministratorOnly")]
|
||||||
public class HyperLinkController : Controller
|
public class HyperLinkController : Controller
|
||||||
{
|
{
|
||||||
private readonly ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
public HyperLinkController(ApplicationDbContext context)
|
public HyperLinkController(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
|
@ -12,7 +12,7 @@ namespace Yavsc.Controllers
|
|||||||
{
|
{
|
||||||
public class LiveFlowController : Controller
|
public class LiveFlowController : Controller
|
||||||
{
|
{
|
||||||
private readonly ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
public LiveFlowController(ApplicationDbContext context)
|
public LiveFlowController(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
|
@ -14,8 +14,8 @@ namespace Yavsc.Controllers
|
|||||||
[Authorize()]
|
[Authorize()]
|
||||||
public class MyFSRulesController : Controller
|
public class MyFSRulesController : Controller
|
||||||
{
|
{
|
||||||
private readonly ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
private readonly ILogger _logger;
|
private ILogger _logger;
|
||||||
|
|
||||||
public MyFSRulesController(ApplicationDbContext context,
|
public MyFSRulesController(ApplicationDbContext context,
|
||||||
ILoggerFactory loggerFactory)
|
ILoggerFactory loggerFactory)
|
||||||
|
@ -9,7 +9,7 @@ namespace Yavsc.Controllers
|
|||||||
{
|
{
|
||||||
public class NotificationsController : Controller
|
public class NotificationsController : Controller
|
||||||
{
|
{
|
||||||
private readonly ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
public NotificationsController(ApplicationDbContext context)
|
public NotificationsController(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
|
@ -16,9 +16,9 @@ namespace Yavsc.Controllers
|
|||||||
[Authorize("AdministratorOnly")]
|
[Authorize("AdministratorOnly")]
|
||||||
public class ActivityController : Controller
|
public class ActivityController : Controller
|
||||||
{
|
{
|
||||||
private readonly ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
readonly IStringLocalizer<Yavsc.YavscLocalisation> SR;
|
IStringLocalizer<Yavsc.YavscLocalisation> SR;
|
||||||
readonly ILogger logger;
|
ILogger logger;
|
||||||
|
|
||||||
public ActivityController(ApplicationDbContext context,
|
public ActivityController(ApplicationDbContext context,
|
||||||
IStringLocalizer<Yavsc.YavscLocalisation> SR,
|
IStringLocalizer<Yavsc.YavscLocalisation> SR,
|
||||||
|
@ -12,7 +12,7 @@ namespace Yavsc.Controllers
|
|||||||
{
|
{
|
||||||
public class ClientController : Controller
|
public class ClientController : Controller
|
||||||
{
|
{
|
||||||
private readonly ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
public ClientController(ApplicationDbContext context)
|
public ClientController(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
|
@ -11,7 +11,7 @@ namespace Yavsc.Controllers
|
|||||||
{
|
{
|
||||||
public class CoWorkingController : Controller
|
public class CoWorkingController : Controller
|
||||||
{
|
{
|
||||||
private readonly ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
public CoWorkingController(ApplicationDbContext context)
|
public CoWorkingController(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
|
@ -90,7 +90,7 @@ namespace Yavsc.Controllers
|
|||||||
/// <param name="id"></param>
|
/// <param name="id"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult Create(string proId, string activityCode)
|
public IActionResult Create(string proId, string activityCode, string billingCode)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(proId))
|
if (string.IsNullOrWhiteSpace(proId))
|
||||||
throw new InvalidOperationException(
|
throw new InvalidOperationException(
|
||||||
@ -159,7 +159,7 @@ namespace Yavsc.Controllers
|
|||||||
_context.RdvQueries.Add(command, GraphBehavior.IncludeDependents);
|
_context.RdvQueries.Add(command, GraphBehavior.IncludeDependents);
|
||||||
_context.SaveChanges(User.GetUserId());
|
_context.SaveChanges(User.GetUserId());
|
||||||
|
|
||||||
var yaev = command.CreateEvent("NewCommand");
|
var yaev = command.CreateEvent(_localizer, "NewCommand");
|
||||||
|
|
||||||
MessageWithPayloadResponse nrep = null;
|
MessageWithPayloadResponse nrep = null;
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ namespace Yavsc.Controllers
|
|||||||
{
|
{
|
||||||
public class CommandFormsController : Controller
|
public class CommandFormsController : Controller
|
||||||
{
|
{
|
||||||
private readonly ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
public CommandFormsController(ApplicationDbContext context)
|
public CommandFormsController(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
|
@ -8,7 +8,7 @@ namespace Yavsc.Controllers
|
|||||||
{
|
{
|
||||||
public class DjSettingsController : Controller
|
public class DjSettingsController : Controller
|
||||||
{
|
{
|
||||||
private readonly ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
public DjSettingsController(ApplicationDbContext context)
|
public DjSettingsController(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
|
@ -17,9 +17,9 @@ namespace Yavsc.Controllers
|
|||||||
[Authorize]
|
[Authorize]
|
||||||
public class DoController : Controller
|
public class DoController : Controller
|
||||||
{
|
{
|
||||||
private readonly ApplicationDbContext dbContext;
|
private ApplicationDbContext dbContext;
|
||||||
readonly ILogger logger;
|
ILogger logger;
|
||||||
readonly IBillingService billing;
|
IBillingService billing;
|
||||||
public DoController(
|
public DoController(
|
||||||
ApplicationDbContext context,
|
ApplicationDbContext context,
|
||||||
IBillingService billing,
|
IBillingService billing,
|
||||||
|
@ -21,9 +21,10 @@ namespace Yavsc.Controllers
|
|||||||
[Authorize]
|
[Authorize]
|
||||||
public class EstimateController : Controller
|
public class EstimateController : Controller
|
||||||
{
|
{
|
||||||
private readonly ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
private readonly SiteSettings _site;
|
private SiteSettings _site;
|
||||||
readonly IAuthorizationService authorizationService;
|
|
||||||
|
IAuthorizationService authorizationService;
|
||||||
|
|
||||||
public EstimateController(ApplicationDbContext context, IAuthorizationService authorizationService, IOptions<SiteSettings> siteSettings)
|
public EstimateController(ApplicationDbContext context, IAuthorizationService authorizationService, IOptions<SiteSettings> siteSettings)
|
||||||
{
|
{
|
||||||
@ -142,6 +143,10 @@ namespace Yavsc.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void Save(ICollection<IFormFile> newGraphics,
|
||||||
|
ICollection<IFormFile> newFiles) {
|
||||||
|
|
||||||
|
}
|
||||||
// GET: Estimate/Edit/5
|
// GET: Estimate/Edit/5
|
||||||
public IActionResult Edit(long? id)
|
public IActionResult Edit(long? id)
|
||||||
{
|
{
|
||||||
|
@ -9,7 +9,7 @@ namespace Yavsc.Controllers
|
|||||||
{
|
{
|
||||||
public class FormsController : Controller
|
public class FormsController : Controller
|
||||||
{
|
{
|
||||||
private readonly ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
public FormsController(ApplicationDbContext context)
|
public FormsController(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
|
@ -18,11 +18,13 @@ namespace Yavsc.Controllers
|
|||||||
|
|
||||||
public class FrontOfficeController : Controller
|
public class FrontOfficeController : Controller
|
||||||
{
|
{
|
||||||
readonly ApplicationDbContext _context;
|
ApplicationDbContext _context;
|
||||||
readonly UserManager<ApplicationUser> _userManager;
|
UserManager<ApplicationUser> _userManager;
|
||||||
readonly ILogger _logger;
|
|
||||||
readonly IStringLocalizer _SR;
|
ILogger _logger;
|
||||||
private readonly IBillingService _billing;
|
|
||||||
|
IStringLocalizer _SR;
|
||||||
|
private IBillingService _billing;
|
||||||
|
|
||||||
public FrontOfficeController(ApplicationDbContext context,
|
public FrontOfficeController(ApplicationDbContext context,
|
||||||
UserManager<ApplicationUser> userManager,
|
UserManager<ApplicationUser> userManager,
|
||||||
|
@ -8,7 +8,7 @@ namespace Yavsc.Controllers
|
|||||||
{
|
{
|
||||||
public class GeneralSettingsController : Controller
|
public class GeneralSettingsController : Controller
|
||||||
{
|
{
|
||||||
private readonly ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
public GeneralSettingsController(ApplicationDbContext context)
|
public GeneralSettingsController(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user