public bool IsEnable(object Sender, object Element) { if (Mediachase.IBN.Business.Security.CurrentUser.IsExternal) { return(false); } if (Element is CommandParameters) { CommandParameters cp = (CommandParameters)Element; string sid = cp.CommandArguments["primaryKeyId"]; string[] elem = sid.Split(new string[] { "::" }, StringSplitOptions.RemoveEmptyEntries); //type, id, _containerName, _containerKey if (elem.Length != 4) { return(false); } int id = -1; int.TryParse(elem[0], out id); if (id == 1) { FileStorage fs = FileStorage.Create(elem[2], elem[3]); DirectoryInfo di = fs.GetDirectory(int.Parse(elem[1])); if (fs.CanUserAdmin(di)) { return(true); } } } return(false); }
public bool IsEnable(object Sender, object Element) { if (Mediachase.IBN.Business.Security.CurrentUser.IsExternal) { return(false); } if (Element is CommandParameters) { CommandParameters cp = (CommandParameters)Element; string containerKey = CHelper.GetFromContext(Mediachase.Ibn.Web.UI.FileLibrary.Modules.FileStorage._containerKeyKey).ToString(); string containerName = CHelper.GetFromContext(Mediachase.Ibn.Web.UI.FileLibrary.Modules.FileStorage._containerNameKey).ToString(); UserLightPropertyCollection _pc = Mediachase.IBN.Business.Security.CurrentUser.Properties; int folderId = int.Parse(_pc["fs_FolderId_" + containerKey]); FileStorage fs = FileStorage.Create(containerName, containerKey); if (fs.CanUserAdmin(folderId)) { return(true); } } return(false); }