public Logs() { ModuleObject = new ModuleObject( "Logs", this, CanSaveHelper ); InitializeComponent(); ActionsManager = new ActionsManager( "" ) { Dispatcher = this.Dispatcher }; ActionsManager.ActionEntryFactory = (creator,name)=> { return new LogEntry(ActionsManager, creator, name); }; lstLogs.Items.Clear(); lstLogs.ItemsSource = ActionsManager.ActionEntries; lstLogs.SelectionChanged += ES.SelectionChanged( lstLogs_SelectionChanged ); ActionsManager.ActionStatusChanged += (actionEntry)=> { lstLogs.Items.Refresh(); }; }
public Boolean DeleteItemCertifications(ModuleObject source, Boolean all, CertificationType type = CertificationType.AutoProduced) { return(DeleteItemCertifications(source, -1, all, type)); }
//public FileStatisticsPresenter(iApplicationContext oContext, IViewFileStatistics view, String IcoMappingPath) // : base(oContext, view) //{ // //this._IcoMappingPath = IcoMappingPath; //Eventualmente sostituire con l'ISession... // this.CurrentManager = new BaseModuleManager(oContext); //} //ref NHibernate.ISession ColSession, ref NHibernate.ISession IcoSession //private void InitPresenter() //{ // //Inizializzazioni varie... //} #region Navigazione public void FirstAccess() { /// /// OCCHIO Mirco, se questa è l'inizializzazione della pagina qui devi definire i current.. /// altrimenti con il bind dati che richiama sempre e comunque le cose che trova via url /// uno sgamato potrebbe comunque fregarti in uno dei vari giri che fai passando /// avanti o indietro visto che sia per l'inizalizzazione che per la navigazione /// chiami sempre i bind dati sia per file che per utenti /// di conseguenza io ho aggiunto questa parte perchè via url passo solo l'id del modulo, /// all'inizializzazione dall'id trovo il code e lo memorizzo nel viewstate /// della pagina. poi agli inizializzatori dei selettori passi sto valore memorizzato /// e non quello caricato da url /// /// @Francesco: /// <Mirco> /// Certo, ma questo riguarda SOLO le logiche di navigazione (avanti-indietro, salti, etc...) /// La parte di "controllo" l'avevo parzialmente saltata, /// anche perchè abbiamo comunque un secondo controllo a livello di UC di visualizzazione. /// Anche modificando i parametri via URL, se l'utente corrente NON HA permessi di selezionare /// file, nel selettore NON HA FILE, se anche seleziona file ed utenti, ma non puo' vedere /// statistiche, NON vengono mostrate. /// /// E' più carino per l'utente essere "bloccato" subito, ma qui abbiamo il casino /// del calcolo dei permessi iniziali. /// View.CurrentModuleOwnerCode = CurrentManager.GetModuleCode(View.PreloadedModuleOwnerId); int idCommunity = View.PreloadedCommunityId; if (idCommunity == 0) { idCommunity = UserContext.CurrentCommunityID; } View.CurrentObjectCommunityId = idCommunity; View.CurrentLinkId = View.PreloadedLinkId; View.CurrentObjectId = View.PreloadedObjectId; View.CurrentObjectTypeId = View.PreloadedObjectTypeId; ModuleObject remoteObject = null; // CONTINUO DOMANI MATTINA QUI= ModuleObject.CreateLongObject(View.CurrentObjectId, View.CurrentObjectTypeId,View.CurrentModuleOwnerCode // StatTreeLeafType permission= View.GetModuleLinkPermission(idCommunity,View.CurrentLinkId,remoteObject,null,UserContext.CurrentUserID); // <Mirco> Modificata la IF sottostante... // Nella VIEW al limite controllo permessi (quello che ti dicevo ieri) // che mi modifica uno qualunque dei parametri sottostanti. if ((View.PreloadedView != FileStatPages.NoPermission) && (View.CurrentStartView != FileStatPages.NoPermission) && (View.CurrentPage != FileStatPages.NoPermission)) { //FileStatPages PageToGo; if (!View.PreloadedAdminView) //Utente <- Modificare IsForAdmin.... { if ((View.CurrentStartView == FileStatPages.Start) || (View.CurrentStartView == FileStatPages.SelectUsers)) { View.CurrentStartView = FileStatPages.SelectFiles; //this.BindStatisticsFiles(); this.View.CurrentIsPathByUser = true; View.CurrentStartView = FileStatPages.SelectFiles; } else { View.CurrentStartView = View.PreloadedView; } View.CurrentIsPathByUser = true; } else { //Amministratore... View.CurrentStartView = View.PreloadedView; switch (View.CurrentStartView) { case FileStatPages.SelectUsers: this.BindSelectionUsers(); View.CurrentIsPathByUser = false; break; case FileStatPages.SelectFiles: this.BindSelectionFiles(); View.CurrentIsPathByUser = true; break; case FileStatPages.StatsUsers: this.BindStatisticsUsers(); View.CurrentIsPathByUser = true; break; case FileStatPages.StatsFiles: this.BindStatisticsFiles(); View.CurrentIsPathByUser = false; break; } } //= FileStatPages.Start Boolean IsStatistics = (View.CurrentStartView == FileStatPages.StatsFiles || View.CurrentStartView == FileStatPages.StatsUsers); View.GoToPage(View.CurrentStartView , (View.CurrentStartView != FileStatPages.Start) && View.CurrentStartView != FileStatPages.StatsFiles && View.CurrentStartView != FileStatPages.StatsUsers , false , IsStatistics , IsStatistics && this.ShowExport()); } else // NON SI HANNO I PERMESSI... { View.GoToPage(FileStatPages.NoPermission, false, false, false, false); } }
public Boolean DeleteItemCertifications(ModuleObject source, CertificationType type) { return(DeleteItemCertifications(source, false, type)); }
public bool AllowStandardAction(StandardActionType actionType, ModuleObject source, ModuleObject destination, int idUser, int idRole, Dictionary <string, long> moduleUserLong = null, Dictionary <string, string> moduleUserString = null) { Boolean AllowAction = false; PermissionEP oPermissionEP = new PermissionEP(0); long idActivity = 0; switch (source.ObjectTypeID) { case (int)COL_BusinessLogic_v2.UCServices.Services_EduPath.ObjectType.SubActivity: idActivity = GetIdActivityBySubActivity(source.ObjectLongID); break; case (int)COL_BusinessLogic_v2.UCServices.Services_EduPath.ObjectType.Activity: if (destination == null) { idActivity = source.ObjectLongID; } else if ((from a in Manager.GetIQ <liteModuleLink>() where a.SourceItem.ObjectLongID == source.ObjectLongID && a.DestinationItem.ObjectLongID == destination.ObjectLongID && a.SourceItem.ObjectTypeID == (int)COL_BusinessLogic_v2.UCServices.Services_EduPath.ObjectType.SubActivity && a.DestinationItem.ObjectTypeID == destination.ObjectTypeID && a.SourceItem.ServiceCode == source.ServiceCode && a.DestinationItem.ServiceCode == destination.ServiceCode select a.Id).Count() > 0) { idActivity = source.ObjectLongID; } break; default: break; } oPermissionEP = GetUserPermission_ByActivity(idActivity, idUser, idRole); switch (actionType) { case StandardActionType.Create: AllowAction = oPermissionEP.Create; break; case StandardActionType.Play: AllowAction = oPermissionEP.Read; break; case StandardActionType.Edit: AllowAction = oPermissionEP.Update; break; case StandardActionType.ViewPersonalStatistics: AllowAction = oPermissionEP.ViewOwnStat; break; case StandardActionType.ViewUserStatistics: AllowAction = oPermissionEP.ViewUserStat; break; case StandardActionType.ViewAdvancedStatistics: AllowAction = oPermissionEP.ViewUserStat; break; default: switch (destination.ServiceCode) { case CoreModuleRepository.UniqueID: AllowAction = GetAllowedActionsForRepository(oPermissionEP, destination.ObjectLongID, idUser, destination.CommunityID).Contains(actionType); break; default: AllowAction = false; break; } break; } return(AllowAction); }
private ModuleGenericTemplateMessages GetPermissions(String moduleCode, long permissions, Int32 idCommunity, TemplateType type) { ModuleGenericTemplateMessages permission = null; Int32 idUser = UserContext.CurrentUserID; switch (type) { case TemplateType.Module: if (moduleCode == ModuleTemplateMessages.UniqueCode) { permission = new ModuleGenericTemplateMessages(Service.GetPermission(idCommunity, OwnerType.Module)); } else { Int32 idModule = CurrentManager.GetModuleID(moduleCode); dtoBaseTemplateOwner ownerInfo = View.PreloadOwnership; ModuleObject obj = (ownerInfo.Type == OwnerType.Object) ? ModuleObject.CreateLongObject(ownerInfo.IdObject, ownerInfo.IdObjectType, ownerInfo.IdObjectCommunity, CurrentManager.GetModuleCode(ownerInfo.IdObjectModule), ownerInfo.IdObjectModule) : null; if (obj != null && obj.ServiceID == 0 && !String.IsNullOrEmpty(obj.ServiceCode)) { obj.ServiceID = CurrentManager.GetModuleID(obj.ServiceCode); } else if (obj != null && obj.ServiceID > 0 && String.IsNullOrEmpty(obj.ServiceCode)) { obj.ServiceCode = CurrentManager.GetModuleCode(obj.ServiceID); } if (permissions > 0) { permission = View.GetModulePermissions(moduleCode, idModule, CurrentManager.GetModulePermission(UserContext.CurrentUserID, idCommunity, idModule), idCommunity, UserContext.UserTypeID, obj); } else { permission = View.GetModulePermissions(moduleCode, idModule, GetModulePermission(idCommunity, idModule), idCommunity, UserContext.UserTypeID, obj); } } break; case TemplateType.User: Person p = GetCurrentUser(ref idUser); Boolean allowView = (p != null && p.TypeID != (Int32)UserTypeStandard.Guest && p.TypeID != (Int32)UserTypeStandard.PublicUser); permission = new ModuleGenericTemplateMessages("personal"); permission.Add = allowView; permission.Administration = allowView; permission.Clone = allowView; permission.DeleteMyTemplates = allowView; permission.Edit = allowView; permission.List = allowView; break; } if (permission == null) { permission = new ModuleGenericTemplateMessages(moduleCode); } return(permission); }
public List <StandardActionType> GetAllowedStandardAction(ModuleObject source, ModuleObject destination, int idUser, int idRole, int idCommunity, Dictionary <string, long> moduleUserLong = null, Dictionary <string, string> moduleUserString = null) { List <StandardActionType> actions = new List <StandardActionType>(); if (source.ServiceCode == "SRVEDUP") { PermissionEP permission = new PermissionEP(RoleEP.None); switch (source.ObjectTypeID) { case (int)ItemType.Path: permission = GetUserPermission_ByPath(source.ObjectLongID, idUser, idRole); break; case (int)ItemType.Unit: permission = GetUserPermission_ByUnit(source.ObjectLongID, idUser, idRole); break; case (int)ItemType.Activity: permission = GetUserPermission_ByActivity(source.ObjectLongID, idUser, idRole); break; case (int)ItemType.SubActivity: SubActivity sub = GetSubActivity(source.ObjectLongID); if (sub != null) { permission = GetUserPermission_ByActivity(sub.ParentActivity.Id, idUser, idRole); } break; } if (permission.ViewOwnStat) { actions.Add(StandardActionType.ViewPersonalStatistics); } if (permission.ViewUserStat) { actions.Add(StandardActionType.ViewUserStatistics); } if (permission.ViewUserStat || permission.Create || permission.Update) { actions.Add(StandardActionType.ViewAdvancedStatistics); } if (permission.Create) { actions.Add(StandardActionType.Create); } if (permission.Create || permission.Update) { actions.Add(StandardActionType.Edit); } switch (destination.ServiceCode) { case CoreModuleRepository.UniqueID: actions = GetAllowedStandardActionForRepository(permission, actions, destination.ObjectLongID, idUser, idCommunity); break; } } // Boolean isMultimedia = (eventItemFile.File.RepositoryItemType != RepositoryItemType.FileStandard && eventItemFile.File.RepositoryItemType != RepositoryItemType.Folder && eventItemFile.File.RepositoryItemType != RepositoryItemType.None); //è multimediale e posso actions.Add(StandardActionType.EditMetadata) //actions.Add(StandardActionType.EditMetadata) // actions.Add(StandardActionType.Play); // actions.Add(StandardActionType.ViewPersonalStatistics); // actions.Add(StandardActionType.ViewAdvancedStatistics); return(actions); }
public dtoOwnership(ModuleObject obj) { Type = OwnershipType.Object; }
public void InitView(String plattformId, long idItem, Guid uniqueId, long idVersion, Guid uniqueIdVersion, ItemType type, long idLink, String language, Boolean saveCompleteness, Boolean isOnModal, Boolean refreshContainer, Boolean saveStatistics) { Guid playUniqueSessionId = Guid.NewGuid(); Guid workingSessionId = UserContext.WorkSessionID; String playSessionId = plattformId + "_" + playUniqueSessionId.ToString(); Int32 idUser = UserContext.CurrentUserID; View.IdItem = idItem; View.IdLink = idLink; View.IdVersion = idVersion; View.ItemType = type; View.SaveStatistics = saveStatistics; View.PlayUniqueSessionId = playUniqueSessionId; View.WorkingSessionId = workingSessionId; View.PlaySessionId = playSessionId; if (SessionTimeout()) { if (isOnModal) { View.DisplaySessionExpired(); } else { View.DisplaySessionTimeout(); } } else if (uniqueId == Guid.Empty || uniqueIdVersion == Guid.Empty) { InitViewForRedirect(idItem, uniqueId, idVersion, uniqueIdVersion, type, idLink, language, saveCompleteness, isOnModal, refreshContainer, saveStatistics); } else { if (String.IsNullOrWhiteSpace(language)) { language = ""; } liteRepositoryItem item = Service.ItemGet(idItem); liteRepositoryItemVersion version = Service.ItemGetVersion(idItem, idVersion); if (version != null && version.Id != idVersion) { View.IdVersion = version.Id; } if (item == null) { View.DisplayUnknownItem(); } else { liteFileTransfer fileTransfer = null; type = item.Type; View.ItemType = type; switch (type) { case ItemType.File: case ItemType.Folder: case ItemType.Link: case ItemType.SharedDocument: case ItemType.VideoStreaming: View.DisplayMessage(item.DisplayName, item.Extension, type, Domain.PlayerErrors.InvalidType); break; case ItemType.ScormPackage: case ItemType.Multimedia: liteModuleLink link = null; Boolean hasPermissions = false; View.ItemIdCommunity = item.IdCommunity; fileTransfer = Service.FileTransferGet(idItem, version.Id); if (idLink == 0) { hasPermissions = Service.HasPermissionToSeeItem(idUser, item, version, ModuleRepository.ActionType.PlayFile); } else { link = CurrentManager.Get <liteModuleLink>(idLink); if (link == null) { View.DisplayMessage(item.DisplayName, item.Extension, item.Type, Domain.PlayerErrors.NoPermissionToPlay); return; } else { if (link.DestinationItem.ObjectIdVersion > 0 && version != null && version.Id != link.DestinationItem.ObjectIdVersion) { version = Service.ItemGetVersion(idItem, link.DestinationItem.ObjectIdVersion); } ModuleObject obj = ModuleObject.CloneObject(link.DestinationItem); obj.ObjectIdVersion = (version != null ? version.Id : obj.ObjectIdVersion); saveCompleteness = link.AutoEvaluable && saveCompleteness; hasPermissions = View.HasPermissionForLink(UserContext.CurrentUserID, idLink, obj, item.Type, link.SourceItem.ServiceID, link.SourceItem.ServiceCode); View.ItemIdCommunity = link.SourceItem.CommunityID; } } Boolean playerLoaded = false; if (version == null) { View.DisplayPlayUnavailable(item.DisplayName, item.Extension, type, (idVersion > 0), ItemAvailability.notavailable, item.Status); } else if (type == ItemType.Multimedia && fileTransfer != null && String.IsNullOrEmpty(fileTransfer.DefaultDocumentPath)) { View.DisplayMessage(item.DisplayName, item.Extension, item.Type, Domain.PlayerErrors.InvalidSettings); } else if ((type == ItemType.Multimedia || type == ItemType.ScormPackage) && fileTransfer == null) { View.DisplayMessage(item.DisplayName, item.Extension, item.Type, Domain.PlayerErrors.InvalidTransfer); } else if (version.Availability == ItemAvailability.available) { playerLoaded = hasPermissions; if (hasPermissions) { LoadPlayer(idUser, playSessionId, workingSessionId, item, version, fileTransfer, link, language, saveCompleteness, isOnModal, refreshContainer, saveStatistics); } else { View.DisplayMessage(item.DisplayName, item.Extension, item.Type, Domain.PlayerErrors.NoPermissionToPlay); } } else { View.DisplayPlayUnavailable(item.DisplayName, item.Extension, type, (idVersion > 0 && item.HasVersions), item.Availability, item.Status); } if (!playerLoaded && !View.PreloadIsOnModal) { Boolean setBackUrl = View.PreloadSetBackUrl; String backUrl = View.PreloadBackUrl; View.BackUrl = (setBackUrl ? backUrl : ""); View.SetPageBackUrl(backUrl); } break; } } } }
// generates HTML for HTML source view public static Task <IEnumerable <XmlToken> > GenerateHtmlSourceHelp(CmdletObject cmdlet, ModuleObject moduleObject) { return(Task <IEnumerable <XmlToken> > .Factory.StartNew(() => XmlTokenizer.LoopTokenize( generatePureHtml(cmdlet, moduleObject.Cmdlets, new StringBuilder(), moduleObject.UseSupports) ) )); }
// generates HTML for web browser control public static Task <String> GenerateHtmlView(CmdletObject cmdlet, ModuleObject moduleObject) { return(Task <String> .Factory.StartNew(() => generatePureHtml(cmdlet, moduleObject.Cmdlets, new StringBuilder(), moduleObject.UseSupports))); }