sync
This commit is contained in:
@ -97,6 +97,8 @@ namespace IronIntel.Contractor.Site
|
||||
|
||||
protected virtual bool CanDirectAccess { get { return false; } }
|
||||
|
||||
protected virtual int FeatureID { get { return -1; } }
|
||||
|
||||
protected bool CheckUserToken()
|
||||
{
|
||||
var session = GetCurrentLoginSession();
|
||||
@ -150,7 +152,7 @@ namespace IronIntel.Contractor.Site
|
||||
RedirectToLoginPage();
|
||||
return false;
|
||||
}
|
||||
if (!AllowCurrentLoginSessionEnter())
|
||||
if (!AllowCurrentLoginSessionEnter() || !CheckRight(FeatureID))
|
||||
{
|
||||
if (ThrowIfNotAllowed)
|
||||
{
|
||||
@ -158,11 +160,7 @@ namespace IronIntel.Contractor.Site
|
||||
}
|
||||
else
|
||||
{
|
||||
string entry = GetUserDefaultEntryPageUrl(session.User);
|
||||
if (string.IsNullOrEmpty(entry))
|
||||
Response.Redirect(entry, true);
|
||||
else
|
||||
Response.Redirect(LoginPageUrl, true);
|
||||
RedirectToEntryPage();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -176,6 +174,25 @@ namespace IronIntel.Contractor.Site
|
||||
Response.Redirect(LoginPageUrl + "?f=" + url);
|
||||
}
|
||||
|
||||
protected void RedirectToEntryPage()
|
||||
{
|
||||
var session = GetCurrentLoginSession();
|
||||
string entry = GetUserDefaultEntryPageUrl(session.User);
|
||||
//if (!user.IsForesightUser)
|
||||
//{
|
||||
// string pageurl = UserParams.GetStringParameter(user.UID, "LandingPage");//如果LandingPage没有权限会现成跳转死循环
|
||||
// if (!string.IsNullOrEmpty(pageurl))
|
||||
// {
|
||||
// string url = entry.Substring(0, entry.LastIndexOf('/') + 1);
|
||||
// entry = url + pageurl;
|
||||
// }
|
||||
//}
|
||||
if (!string.IsNullOrEmpty(entry))
|
||||
Response.Redirect(entry, true);
|
||||
else
|
||||
Response.Redirect(LoginPageUrl, true);
|
||||
}
|
||||
|
||||
protected void DoLogout()
|
||||
{
|
||||
string sid = null;
|
||||
@ -268,6 +285,12 @@ namespace IronIntel.Contractor.Site
|
||||
var session = GetCurrentLoginSession();
|
||||
return FleetServiceClientHelper.CreateClient<T>(companyid, session == null ? "" : session.SessionID);
|
||||
}
|
||||
protected bool CheckRight(int featureid)
|
||||
{
|
||||
if (featureid < 0)
|
||||
return true;
|
||||
return CheckRight(SystemParams.CompanyID, featureid);
|
||||
}
|
||||
|
||||
protected bool CheckRight(string custid, int featureid)
|
||||
{
|
||||
|
@ -65,9 +65,7 @@ namespace IronIntel.Contractor.Site
|
||||
}
|
||||
var ui = UserManagement.GetUserByIID(session.User.UID);
|
||||
return ui != null && ui.UserType >= UserTypes.Admin;
|
||||
}
|
||||
|
||||
protected override bool ThrowIfNotAllowed { get { return true; } }
|
||||
}
|
||||
|
||||
private void GetCredentials()
|
||||
{
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Foresight.Fleet.Services.JobSite;
|
||||
using Foresight.Fleet.Services.MapView;
|
||||
using Foresight.Standard;
|
||||
using IronIntel.Contractor.FilterQ;
|
||||
using IronIntel.Contractor.JobSites;
|
||||
@ -248,15 +249,15 @@ namespace IronIntel.Contractor.Site
|
||||
}
|
||||
}
|
||||
|
||||
private AssetViewItem[] GetMachines()
|
||||
private AssetMapViewPinItem[] GetMachines()
|
||||
{
|
||||
var session = GetCurrentLoginSession();
|
||||
if (session != null)
|
||||
{
|
||||
AssetViewItem[] items = AssetMapViewManagement.GetAssets(session.SessionID, SystemParams.CompanyID, session.User.UID, "", -1, null, false);
|
||||
AssetMapViewPinItem[] items = AssetMapViewManagement.GetAssets(session.SessionID, SystemParams.CompanyID, session.User.UID, "", -1, null, false);
|
||||
return items;
|
||||
}
|
||||
return new AssetViewItem[0];
|
||||
return new AssetMapViewPinItem[0];
|
||||
}
|
||||
|
||||
private object[] GetSelectedAssets()
|
||||
@ -398,7 +399,7 @@ namespace IronIntel.Contractor.Site
|
||||
MachineViewItem[] items = JobSitesManagement.GetBindingMachines(session.SessionID, session.User.UID);
|
||||
if (items != null)
|
||||
{
|
||||
items = items.OrderBy((m) => m.ShowName).ToArray();
|
||||
items = items.OrderBy((m) => m.DisplayName).ToArray();
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
@ -523,7 +523,7 @@ namespace IronIntel.Contractor.Site
|
||||
if (machines == null)
|
||||
return new MachineItem[0];
|
||||
|
||||
return machines.Where(m => m.Hide == false).OrderBy(m => m.ShowName).ToArray();
|
||||
return machines.Where(m => m.Hide == false).OrderBy(m => m.DisplayName).ToArray();
|
||||
}
|
||||
else
|
||||
return new MachineItem[0];
|
||||
@ -554,7 +554,7 @@ namespace IronIntel.Contractor.Site
|
||||
if (machines == null)
|
||||
return new MachineItem[0];
|
||||
|
||||
return machines.Where(m => m.Hide == false).OrderBy(m => m.ShowName).ToArray();
|
||||
return machines.Where(m => m.Hide == false).OrderBy(m => m.DisplayName).ToArray();
|
||||
}
|
||||
else
|
||||
return new MachineItem[0];
|
||||
@ -630,6 +630,9 @@ namespace IronIntel.Contractor.Site
|
||||
contractorid = SystemParams.CompanyID;
|
||||
string searchtxt = HttpUtility.HtmlDecode(ps[1]);
|
||||
FFSDevice.DeviceInfo[] devs = CreateClient<DeviceProvider>(contractorid).GetDevices(contractorid, searchtxt);
|
||||
|
||||
if (devs == null)
|
||||
return new DeviceItem[0];
|
||||
List<DeviceItem> list = new List<DeviceItem>();
|
||||
foreach (var dev in devs)
|
||||
{
|
||||
|
@ -104,7 +104,8 @@ namespace IronIntel.Contractor.Site.Maintenance
|
||||
{
|
||||
FuelRecordInfo fi = new FuelRecordInfo();
|
||||
Helper.CloneProperty(fi, fuel);
|
||||
fi.TransactionDate = fi.TransactionDate.ToLocalTime();
|
||||
//fi.TransactionDate = fi.TransactionDate.ToLocalTime();
|
||||
fi.TransactionDate = SystemParams.CustomerDetail.UtcToCustomerTime(fi.TransactionDate);
|
||||
list.Add(fi);
|
||||
}
|
||||
|
||||
@ -138,7 +139,8 @@ namespace IronIntel.Contractor.Site.Maintenance
|
||||
{
|
||||
FuelRecordAuditItem fi = new FuelRecordAuditItem();
|
||||
Helper.CloneProperty(fi, fuel);
|
||||
fi.TransactionDate = fi.TransactionDate.ToLocalTime();
|
||||
//fi.TransactionDate = fi.TransactionDate.ToLocalTime();
|
||||
fi.TransactionDate=SystemParams.CustomerDetail.UtcToCustomerTime(fi.TransactionDate);
|
||||
fi.AddedOn = fi.AddedOn.ToLocalTime();
|
||||
fi.LastUpdatedOn = fi.LastUpdatedOn.ToLocalTime();
|
||||
list.Add(fi);
|
||||
@ -169,7 +171,8 @@ namespace IronIntel.Contractor.Site.Maintenance
|
||||
|
||||
FuelRecord record = new FuelRecord();
|
||||
Helper.CloneProperty(record, fuelrecord);
|
||||
record.TransactionDate = record.TransactionDate.ToUniversalTime();
|
||||
//record.TransactionDate = record.TransactionDate.ToUniversalTime();
|
||||
record.TransactionDate = SystemParams.CustomerDetail.CustomerTimeToUtc(record.TransactionDate);
|
||||
long fuleid = record.FuelID;
|
||||
if (record.FuelID == -1)
|
||||
{
|
||||
|
@ -369,7 +369,7 @@ namespace IronIntel.Contractor.Site.Maintenance
|
||||
{
|
||||
machines = new MachineItem[0];
|
||||
}
|
||||
return machines.Where(m => m.Hide == false).OrderBy(m => m.ShowName).ToArray();
|
||||
return machines.Where(m => m.Hide == false).OrderBy(m => m.DisplayName).ToArray();
|
||||
}
|
||||
|
||||
|
||||
|
@ -116,9 +116,9 @@ namespace IronIntel.Contractor.Site.MapView
|
||||
string serverVersion = SystemParams.GetVersion();
|
||||
return serverVersion;
|
||||
}
|
||||
private AssetViewItem[] GetAssets()
|
||||
private object GetAssets()
|
||||
{
|
||||
AssetViewItem[] assets = null;
|
||||
AssetMapViewPinItem[] assets = null;
|
||||
if (LoginSession != null)
|
||||
{
|
||||
var clientdata = Context.Request.Params["ClientData"];
|
||||
@ -136,9 +136,23 @@ namespace IronIntel.Contractor.Site.MapView
|
||||
SystemParams.WriteRefreshLog(LoginSession.User.UID, UserHostAddress, "Assets", p.IsAutoRefresh ? "Auto" : "Manual");
|
||||
}
|
||||
else
|
||||
assets = new AssetViewItem[0];
|
||||
assets = new AssetMapViewPinItem[0];
|
||||
|
||||
return assets;
|
||||
List<string> results = new List<string>();
|
||||
foreach (var r in assets)
|
||||
{
|
||||
//if (sb.Length > 0)
|
||||
//{
|
||||
// sb.Append((char)171);
|
||||
//}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
r.ToFormatedString(sb, (char)170);
|
||||
results.Add(sb.ToString());
|
||||
}
|
||||
|
||||
return results.ToArray();
|
||||
|
||||
//return assets;
|
||||
}
|
||||
|
||||
private AssetGroupViewItem[] GetAssetGroups()
|
||||
|
@ -33,4 +33,4 @@ using System.Runtime.InteropServices;
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("2.20.526")]
|
||||
[assembly: AssemblyFileVersion("2.20.609")]
|
||||
|
@ -96,6 +96,9 @@ namespace IronIntel.Contractor.Site
|
||||
case "GETFEATURESDEFINEDONUSER":
|
||||
result = GetFeaturesDefinedOnUser();
|
||||
break;
|
||||
case "GETFEATURESMOUDULES":
|
||||
result = GetFeaturesMoudules();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -197,6 +200,7 @@ namespace IronIntel.Contractor.Site
|
||||
{
|
||||
var uid = Request.Form["ClientData"];
|
||||
var user = UserManagement.GetUserByIID(uid);
|
||||
user.LandingPage = UserParams.GetStringParameter(uid, "LandingPage");
|
||||
if (user == null)
|
||||
user = new UserInfo();
|
||||
return user;
|
||||
@ -227,6 +231,25 @@ namespace IronIntel.Contractor.Site
|
||||
}
|
||||
item.Active = true;
|
||||
item.IID = UserManagement.AddUser(item, item.TransPass, session.User.UID, session.SessionID, Request.UserHostName);
|
||||
if (item.UserType == UserTypes.Common)
|
||||
{
|
||||
List<KeyValuePair<int, Foresight.Fleet.Services.User.Permissions[]>> features = new List<KeyValuePair<int, Foresight.Fleet.Services.User.Permissions[]>>();
|
||||
KeyValuePair<int, Foresight.Fleet.Services.User.Permissions[]> feature = new KeyValuePair<int, Foresight.Fleet.Services.User.Permissions[]>(100, new Foresight.Fleet.Services.User.Permissions[] { Foresight.Fleet.Services.User.Permissions.FullControl });
|
||||
features.Add(feature);
|
||||
feature = new KeyValuePair<int, Foresight.Fleet.Services.User.Permissions[]>(200, new Foresight.Fleet.Services.User.Permissions[] { Foresight.Fleet.Services.User.Permissions.FullControl });
|
||||
features.Add(feature);
|
||||
feature = new KeyValuePair<int, Foresight.Fleet.Services.User.Permissions[]>(210, new Foresight.Fleet.Services.User.Permissions[] { Foresight.Fleet.Services.User.Permissions.FullControl });
|
||||
features.Add(feature);
|
||||
feature = new KeyValuePair<int, Foresight.Fleet.Services.User.Permissions[]>(220, new Foresight.Fleet.Services.User.Permissions[] { Foresight.Fleet.Services.User.Permissions.FullControl });
|
||||
features.Add(feature);
|
||||
feature = new KeyValuePair<int, Foresight.Fleet.Services.User.Permissions[]>(230, new Foresight.Fleet.Services.User.Permissions[] { Foresight.Fleet.Services.User.Permissions.FullControl });
|
||||
features.Add(feature);
|
||||
feature = new KeyValuePair<int, Foresight.Fleet.Services.User.Permissions[]>(600, new Foresight.Fleet.Services.User.Permissions[] { Foresight.Fleet.Services.User.Permissions.FullControl });
|
||||
features.Add(feature);
|
||||
|
||||
var client = CreateClient<Foresight.Fleet.Services.User.PermissionProvider>();
|
||||
client.UpdateFeaturesForUser(SystemParams.CompanyID, item.IID, features.ToArray(), session.User.UID);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -250,6 +273,7 @@ namespace IronIntel.Contractor.Site
|
||||
FI.FIC.Models.Schedule.ScheduleManager.SaveEmailScheduleItems(item.IID, user.Schedule, "en-us");
|
||||
}
|
||||
}
|
||||
UserParams.SetStringParameter(item.IID, "LandingPage", item.LandingPage);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -565,12 +589,33 @@ namespace IronIntel.Contractor.Site
|
||||
var p = JsonConvert.DeserializeObject<StringKeyValue>(s);
|
||||
|
||||
var machines = MaintenanceManagement.GetMaintenanceMachines(session.SessionID, int.Parse(p.Key), p.Value, session.User.UID)
|
||||
.OrderBy(m => m.ShowName)
|
||||
.OrderBy(m => m.DisplayName)
|
||||
.ToArray();
|
||||
|
||||
return machines;
|
||||
}
|
||||
|
||||
private object GetFeaturesMoudules()
|
||||
{
|
||||
try
|
||||
{
|
||||
var session = GetCurrentLoginSession();
|
||||
if (session != null)
|
||||
{
|
||||
List<AppModuleInfo> list = Acl.GetAvailableAppModuleInfos(session.User.UID).ToList();
|
||||
return list.ToArray();
|
||||
}
|
||||
else
|
||||
{
|
||||
return new AppModuleInfo[0];
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ex.Message;
|
||||
}
|
||||
}
|
||||
|
||||
private class UserMachineGroupInfoItem
|
||||
{
|
||||
public MachineGroup[] AllMachineGroups { get; set; }
|
||||
|
Reference in New Issue
Block a user