Merge
This commit is contained in:
commit
5a2d487e55
41 changed files with 891 additions and 426 deletions
|
@ -4155,5 +4155,48 @@ namespace WebsitePanel.EnterpriseServer
|
|||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Enterprise Storage
|
||||
|
||||
public static int AddEntepriseFolder(int itemId, string folderName)
|
||||
{
|
||||
SqlParameter prmId = new SqlParameter("@FolderID", SqlDbType.Int);
|
||||
prmId.Direction = ParameterDirection.Output;
|
||||
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"AddEnterpriseFolder",
|
||||
prmId,
|
||||
new SqlParameter("@ItemID", itemId),
|
||||
new SqlParameter("@FolderName", folderName));
|
||||
|
||||
// read identity
|
||||
return Convert.ToInt32(prmId.Value);
|
||||
}
|
||||
|
||||
public static void DeleteEnterpriseFolder(int itemId, string folderName)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"DeleteEnterpriseFolder",
|
||||
new SqlParameter("@ItemID", itemId),
|
||||
new SqlParameter("@FolderName", folderName));
|
||||
}
|
||||
|
||||
public static void UpdateEnterpriseFolder(int itemId, string folderID, string folderName, int folderQuota)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"UpdateEnterpriseFolder",
|
||||
new SqlParameter("@ItemID", itemId),
|
||||
new SqlParameter("@FolderID", folderID),
|
||||
new SqlParameter("@FolderName", folderName),
|
||||
new SqlParameter("@FolderQuota", folderQuota));
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -141,9 +141,9 @@ namespace WebsitePanel.EnterpriseServer
|
|||
return CheckUsersDomainExistsInternal(itemId);
|
||||
}
|
||||
|
||||
public static void SetFRSMQuotaOnFolder(int itemId, string folderName, int quota)
|
||||
public static void SetFRSMQuotaOnFolder(int itemId, string folderName, int quota, QuotaType quotaType)
|
||||
{
|
||||
SetFRSMQuotaOnFolderInternal(itemId, folderName, quota);
|
||||
SetFRSMQuotaOnFolderInternal(itemId, folderName, quota, quotaType);
|
||||
}
|
||||
|
||||
#region Directory Browsing
|
||||
|
@ -396,7 +396,16 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
EnterpriseStorage es = GetEnterpriseStorage(GetEnterpriseStorageServiceID(org.PackageId));
|
||||
|
||||
return es.RenameFolder(org.OrganizationId, oldFolder, newFolder);
|
||||
if (es.GetFolder(org.OrganizationId, newFolder) == null)
|
||||
{
|
||||
SystemFile folder = es.RenameFolder(org.OrganizationId, oldFolder, newFolder);
|
||||
|
||||
DataProvider.UpdateEnterpriseFolder(itemId, oldFolder, newFolder, folder.FRSMQuotaGB);
|
||||
|
||||
return folder;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -421,7 +430,18 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
EnterpriseStorage es = GetEnterpriseStorage(GetEnterpriseStorageServiceID(org.PackageId));
|
||||
|
||||
es.CreateFolder(org.OrganizationId, folderName);
|
||||
if (es.GetFolder(org.OrganizationId, folderName) == null)
|
||||
{
|
||||
es.CreateFolder(org.OrganizationId, folderName);
|
||||
|
||||
DataProvider.AddEntepriseFolder(itemId, folderName);
|
||||
}
|
||||
else
|
||||
{
|
||||
result.IsSuccess = false;
|
||||
result.AddError("Enterprise Storage", new Exception("Folder already exist"));
|
||||
return result;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -442,7 +462,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
return result;
|
||||
}
|
||||
|
||||
protected static void SetFRSMQuotaOnFolderInternal(int itemId, string folderName, int quota)
|
||||
protected static void SetFRSMQuotaOnFolderInternal(int itemId, string folderName, int quota, QuotaType quotaType)
|
||||
{
|
||||
ResultObject result = TaskManager.StartResultTask<ResultObject>("ENTERPRISE_STORAGE", "CREATE_FOLDER");
|
||||
|
||||
|
@ -462,7 +482,9 @@ namespace WebsitePanel.EnterpriseServer
|
|||
// check if it's not root folder
|
||||
if (!string.IsNullOrEmpty(folderName))
|
||||
{
|
||||
SetFolderQuota(org.PackageId, org.OrganizationId, folderName, quota);
|
||||
SetFolderQuota(org.PackageId, org.OrganizationId, folderName, quota, quotaType);
|
||||
|
||||
DataProvider.UpdateEnterpriseFolder(itemId, folderName, folderName, quota);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -498,6 +520,8 @@ namespace WebsitePanel.EnterpriseServer
|
|||
EnterpriseStorage es = GetEnterpriseStorage(GetEnterpriseStorageServiceID(org.PackageId));
|
||||
|
||||
es.DeleteFolder(org.OrganizationId, folderName);
|
||||
|
||||
DataProvider.DeleteEnterpriseFolder(itemId, folderName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -804,15 +828,19 @@ namespace WebsitePanel.EnterpriseServer
|
|||
rule.Users.Add(permission.Account);
|
||||
}
|
||||
|
||||
if (permission.Access.ToLower().Contains("read-only"))
|
||||
if (permission.Access.ToLower().Contains("read"))
|
||||
{
|
||||
rule.Read = true;
|
||||
}
|
||||
|
||||
if (permission.Access.ToLower().Contains("read-write"))
|
||||
if (permission.Access.ToLower().Contains("write"))
|
||||
{
|
||||
rule.Write = true;
|
||||
rule.Read = true;
|
||||
}
|
||||
|
||||
if (permission.Access.ToLower().Contains("source"))
|
||||
{
|
||||
rule.Source = true;
|
||||
}
|
||||
|
||||
rule.Pathes.Add("*");
|
||||
|
@ -860,15 +888,25 @@ namespace WebsitePanel.EnterpriseServer
|
|||
permission.DisplayName = userObj.DisplayName;
|
||||
}
|
||||
|
||||
if (rule.Read && !rule.Write)
|
||||
if (rule.Read)
|
||||
{
|
||||
permission.Access = "Read-Only";
|
||||
}
|
||||
if (rule.Write)
|
||||
{
|
||||
permission.Access = "Read-Write";
|
||||
permission.Access += "Read,";
|
||||
}
|
||||
|
||||
if (rule.Write)
|
||||
{
|
||||
permission.Access += "Write,";
|
||||
}
|
||||
|
||||
if (rule.Source)
|
||||
{
|
||||
permission.Access += "Source";
|
||||
}
|
||||
|
||||
if (permission.Access[permission.Access.Length - 1] == ',')
|
||||
{
|
||||
permission.Access = permission.Access.Remove(permission.Access.Length - 1);
|
||||
}
|
||||
|
||||
permissions.Add(permission);
|
||||
}
|
||||
|
@ -877,7 +915,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
}
|
||||
|
||||
private static void SetFolderQuota(int packageId, string orgId, string folderName, int quotaSize)
|
||||
private static void SetFolderQuota(int packageId, string orgId, string folderName, int quotaSize, QuotaType quotaType)
|
||||
{
|
||||
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
|
||||
if (accountCheck < 0)
|
||||
|
@ -899,10 +937,6 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
var orgFolder = Path.Combine(usersHome, orgId, folderName);
|
||||
|
||||
FSRMQuotaType quotaType = (esSesstings["enablehardquota"] != null)
|
||||
? bool.Parse(esSesstings["enablehardquota"]) == true ? FSRMQuotaType.Hard : FSRMQuotaType.Soft
|
||||
: FSRMQuotaType.Soft;
|
||||
|
||||
var os = GetOS(packageId);
|
||||
|
||||
if (os != null && os.CheckFileServicesInstallation())
|
||||
|
|
|
@ -910,7 +910,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
return users.ToArray();
|
||||
}
|
||||
|
||||
public static int SetFolderQuota(int packageId, string path, string driveName,string quotas)
|
||||
public static int SetFolderQuota(int packageId, string path, string driveName, string quotas)
|
||||
{
|
||||
|
||||
// check account
|
||||
|
@ -948,7 +948,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
OS.OperatingSystem os = GetOS(packageId);
|
||||
|
||||
os.SetQuotaLimitOnFolder(path, driveName, FSRMQuotaType.Hard, diskSpaceQuota.QuotaAllocatedValue.ToString() + unit, 0, String.Empty, String.Empty);
|
||||
os.SetQuotaLimitOnFolder(path, driveName, QuotaType.Hard, diskSpaceQuota.QuotaAllocatedValue.ToString() + unit, 0, String.Empty, String.Empty);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -960,10 +960,8 @@ namespace WebsitePanel.EnterpriseServer
|
|||
SystemFile[] folders = EnterpriseStorageController.GetFolders(itemId);
|
||||
|
||||
stats.CreatedEnterpriseStorageFolders = folders.Count();
|
||||
|
||||
stats.UsedEnterpriseStorageSpace = (int)folders.Sum(x => x.Size);
|
||||
|
||||
stats.AllocatedEnterpriseStorageSpace = folders.Where(x => x.FRSMQuotaMB != -1).Sum(x => x.FRSMQuotaMB);
|
||||
|
||||
stats.UsedEnterpriseStorageSpace = folders.Where(x => x.FRSMQuotaGB != -1).Sum(x => x.FRSMQuotaGB);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1026,10 +1024,8 @@ namespace WebsitePanel.EnterpriseServer
|
|||
SystemFile[] folders = EnterpriseStorageController.GetFolders(o.Id);
|
||||
|
||||
stats.CreatedEnterpriseStorageFolders += folders.Count();
|
||||
|
||||
stats.UsedEnterpriseStorageSpace += (int)folders.Sum(x => x.Size);
|
||||
|
||||
stats.AllocatedEnterpriseStorageSpace += folders.Where(x => x.FRSMQuotaMB != -1).Sum(x => x.FRSMQuotaMB);
|
||||
stats.UsedEnterpriseStorageSpace += folders.Where(x => x.FRSMQuotaGB != -1).Sum(x => x.FRSMQuotaGB);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1073,6 +1069,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
if (cntx.Groups.ContainsKey(ResourceGroups.EnterpriseStorage))
|
||||
{
|
||||
stats.AllocatedEnterpriseStorageFolders = cntx.Quotas[Quotas.ENTERPRISESTORAGE_FOLDERS].QuotaAllocatedValue;
|
||||
stats.AllocatedEnterpriseStorageSpace = cntx.Quotas[Quotas.ENTERPRISESTORAGE_DISKSTORAGESPACE].QuotaAllocatedValue;
|
||||
}
|
||||
|
||||
return stats;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue