MOBILE-4469 site: Rename candidate site to authenticated site

main
Dani Palou 2023-11-22 10:20:12 +01:00
parent 006f9018a9
commit 3b99950df6
68 changed files with 98 additions and 98 deletions

View File

@ -16,7 +16,7 @@ import { Injectable } from '@angular/core';
import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreCourse } from '@features/course/services/course';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import { makeSingleton } from '@singletons';
import { CoreCourseModuleDelegate } from '@features/course/services/module-delegate';

View File

@ -14,7 +14,7 @@
import { Injectable } from '@angular/core';
import { CoreSites } from '@services/sites';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import { makeSingleton } from '@singletons';
const ROOT_CACHE_KEY = 'AddonBlockStarredCourses:';

View File

@ -24,7 +24,7 @@ import {
} from '@addons/calendar/services/calendar';
import moment from 'moment-timezone';
import { makeSingleton } from '@singletons';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
// Cache key was maintained from block myoverview when blocks were splitted.
const ROOT_CACHE_KEY = 'myoverview:';

View File

@ -13,7 +13,7 @@
// limitations under the License.
import { Injectable } from '@angular/core';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import { CoreSite } from '@classes/sites/site';
import { CoreTagItem } from '@features/tag/services/tag';
import { CoreSites } from '@services/sites';

View File

@ -50,7 +50,7 @@ import {
} from '@features/reminders/services/reminders';
import { CoreReminderDBRecord } from '@features/reminders/services/database/reminders';
import { CoreEvents } from '@singletons/events';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
const ROOT_CACHE_KEY = 'mmaCalendar:';

View File

@ -13,7 +13,7 @@
// limitations under the License.
import { Injectable } from '@angular/core';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import { CoreSite } from '@classes/sites/site';
import { CoreCommentsArea } from '@features/comments/services/comments';
import { CoreCourseSummary, CoreCourseModuleSummary } from '@features/course/services/course';

View File

@ -23,7 +23,7 @@ import { makeSingleton } from '@singletons';
import { CoreError } from '@classes/errors/error';
import { asyncObservable, firstValueFrom } from '@/core/utils/rxjs';
import { map } from 'rxjs/operators';
import { CoreSiteWSPreSets, WSObservable } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets, WSObservable } from '@classes/sites/authenticated-site';
const ROOT_CACHE_KEY = 'mmaCourseCompletion:';

View File

@ -13,7 +13,7 @@
// limitations under the License.
import { Injectable } from '@angular/core';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import { CoreSite } from '@classes/sites/site';
import { CoreEnrolEnrolmentInfo } from '@features/enrol/services/enrol';
import { CoreSites } from '@services/sites';

View File

@ -14,7 +14,7 @@
import { Injectable } from '@angular/core';
import { CoreWSError } from '@classes/errors/wserror';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import { CoreSite } from '@classes/sites/site';
import { CoreCoursesProvider } from '@features/courses/services/courses';
import { CoreSites } from '@services/sites';

View File

@ -25,7 +25,7 @@ import { CoreEvents, CoreEventSiteData } from '@singletons/events';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreUtils } from '@services/utils/utils';
import { CorePath } from '@singletons/path';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
const ROOT_CACHE_KEY = 'mmaMessageOutputAirnotifier:';

View File

@ -31,7 +31,7 @@ import { CoreConstants } from '@/core/constants';
import { CoreUser } from '@features/user/services/user';
import { CoreError } from '@classes/errors/error';
import { CoreTextErrorObject, CoreTextUtils } from '@services/utils/text';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
/**
* Service to sync messages.

View File

@ -33,7 +33,7 @@ import { CoreError } from '@classes/errors/error';
import { AddonMessagesSyncEvents, AddonMessagesSyncProvider } from './messages-sync';
import { CoreWSError } from '@classes/errors/wserror';
import { AddonNotificationsPreferencesNotificationProcessorState } from '@addons/notifications/services/notifications';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
const ROOT_CACHE_KEY = 'mmaMessages:';

View File

@ -35,7 +35,7 @@ import { AddonModAssignAutoSyncData, AddonModAssignManualSyncData, AddonModAssig
import { CoreFormFields } from '@singletons/form';
import { CoreFileHelper } from '@services/file-helper';
import { CoreIonicColorNames } from '@singletons/colors';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
const ROOT_CACHE_KEY = 'mmaModAssign:';

View File

@ -15,7 +15,7 @@
import { Injectable } from '@angular/core';
import { CoreError } from '@classes/errors/error';
import { CoreWSError } from '@classes/errors/wserror';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import { CoreSite } from '@classes/sites/site';
import { CoreCourseCommonModWSOptions } from '@features/course/services/course';
import { CoreCourseLogHelper } from '@features/course/services/log-helper';

View File

@ -26,7 +26,7 @@ import { CoreTextUtils } from '@services/utils/text';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreFile } from '@services/file';
import { CoreError } from '@classes/errors/error';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
/**
* Constants to define how the chapters and subchapters of a book should be displayed in that table of contents.

View File

@ -14,7 +14,7 @@
import { Injectable } from '@angular/core';
import { CoreError } from '@classes/errors/error';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import { CoreSite } from '@classes/sites/site';
import { CoreCourseCommonModWSOptions } from '@features/course/services/course';
import { CoreCourseLogHelper } from '@features/course/services/log-helper';

View File

@ -26,7 +26,7 @@ import { CoreStatusWithWarningsWSResponse, CoreWSExternalFile, CoreWSExternalWar
import { makeSingleton, Translate } from '@singletons';
import { AddonModChoiceOffline } from './choice-offline';
import { AddonModChoiceAutoSyncData, AddonModChoiceSyncProvider } from './choice-sync';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
const ROOT_CACHE_KEY = 'mmaModChoice:';

View File

@ -29,7 +29,7 @@ import { makeSingleton, Translate } from '@singletons';
import { AddonModDataFieldsDelegate } from './data-fields-delegate';
import { AddonModDataOffline } from './data-offline';
import { AddonModDataAutoSyncData, AddonModDataSyncProvider } from './data-sync';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
const ROOT_CACHE_KEY = 'mmaModData:';

View File

@ -25,7 +25,7 @@ import { CoreWSExternalFile, CoreWSExternalWarning, CoreWSStoredFile } from '@se
import { makeSingleton, Translate } from '@singletons';
import { AddonModFeedbackOffline } from './feedback-offline';
import { AddonModFeedbackAutoSyncData, AddonModFeedbackSyncProvider } from './feedback-sync';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
const ROOT_CACHE_KEY = 'AddonModFeedback:';

View File

@ -14,7 +14,7 @@
import { Injectable } from '@angular/core';
import { CoreError } from '@classes/errors/error';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import { CoreSite } from '@classes/sites/site';
import { CoreCourse } from '@features/course/services/course';
import { CoreCourseLogHelper } from '@features/course/services/log-helper';

View File

@ -29,7 +29,7 @@ import { CoreUtils } from '@services/utils/utils';
import { CoreStatusWithWarningsWSResponse, CoreWSExternalFile, CoreWSExternalWarning, CoreWSStoredFile } from '@services/ws';
import { makeSingleton, Translate } from '@singletons';
import { AddonModForumOffline, AddonModForumOfflineDiscussion, AddonModForumReplyOptions } from './forum-offline';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
const ROOT_CACHE_KEY = 'mmaModForum:';

View File

@ -28,7 +28,7 @@ import { makeSingleton, Translate } from '@singletons';
import { CoreEvents } from '@singletons/events';
import { AddonModGlossaryEntryDBRecord, ENTRIES_TABLE_NAME } from './database/glossary';
import { AddonModGlossaryOffline } from './glossary-offline';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
export const GLOSSARY_ENTRY_ADDED = 'addon_mod_glossary_entry_added';
export const GLOSSARY_ENTRY_UPDATED = 'addon_mod_glossary_entry_updated';

View File

@ -27,7 +27,7 @@ import { CoreWSError } from '@classes/errors/wserror';
import { CoreError } from '@classes/errors/error';
import { AddonModH5PActivityAutoSyncData, AddonModH5PActivitySyncProvider } from './h5pactivity-sync';
import { CoreTime } from '@singletons/time';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
export const MOD_H5PACTIVITY_STATE_ID = 'state';

View File

@ -26,7 +26,7 @@ import { CoreUtils } from '@services/utils/utils';
import { CoreWSExternalFile, CoreWSExternalWarning } from '@services/ws';
import { makeSingleton, Translate } from '@singletons';
import { CorePath } from '@singletons/path';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
const ROOT_CACHE_KEY = 'mmaModImscp:';

View File

@ -14,7 +14,7 @@
import { Injectable } from '@angular/core';
import { CoreError } from '@classes/errors/error';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import { CoreSite } from '@classes/sites/site';
import { CoreFilepool } from '@services/filepool';
import { CoreSites, CoreSitesCommonWSOptions } from '@services/sites';

View File

@ -28,7 +28,7 @@ import { CoreEvents } from '@singletons/events';
import { AddonModLessonPasswordDBRecord, PASSWORD_TABLE_NAME } from './database/lesson';
import { AddonModLessonOffline, AddonModLessonPageAttemptRecord } from './lesson-offline';
import { AddonModLessonAutoSyncData, AddonModLessonSyncProvider } from './lesson-sync';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
const ROOT_CACHE_KEY = 'mmaModLesson:';

View File

@ -15,7 +15,7 @@
import { Injectable } from '@angular/core';
import { CoreError } from '@classes/errors/error';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import { CoreSite } from '@classes/sites/site';
import { CoreCourseLogHelper } from '@features/course/services/log-helper';
import { CoreFile } from '@services/file';

View File

@ -22,7 +22,7 @@ import { CoreCourse } from '@features/course/services/course';
import { CoreUtils } from '@services/utils/utils';
import { CoreCourseLogHelper } from '@features/course/services/log-helper';
import { CoreError } from '@classes/errors/error';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
const ROOT_CACHE_KEY = 'mmaModPage:';

View File

@ -40,7 +40,7 @@ import { AddonModQuizAccessRuleDelegate } from './access-rules-delegate';
import { AddonModQuizAttempt } from './quiz-helper';
import { AddonModQuizOffline, AddonModQuizQuestionsWithAnswers } from './quiz-offline';
import { AddonModQuizAutoSyncData, AddonModQuizSyncProvider } from './quiz-sync';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
const ROOT_CACHE_KEY = 'mmaModQuiz:';

View File

@ -14,7 +14,7 @@
import { Injectable } from '@angular/core';
import { CoreError } from '@classes/errors/error';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import { CoreSite } from '@classes/sites/site';
import { CoreCourse } from '@features/course/services/course';
import { CoreCourseLogHelper } from '@features/course/services/log-helper';

View File

@ -31,7 +31,7 @@ import { CoreEvents } from '@singletons/events';
import { CorePath } from '@singletons/path';
import { AddonModScormOffline } from './scorm-offline';
import { AddonModScormAutoSyncEventData, AddonModScormSyncProvider } from './scorm-sync';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
// Private constants.
const VALID_STATUSES = ['notattempted', 'passed', 'completed', 'failed', 'incomplete', 'browsed', 'suspend'];

View File

@ -24,7 +24,7 @@ import { CoreUtils } from '@services/utils/utils';
import { CoreStatusWithWarningsWSResponse, CoreWSExternalFile, CoreWSExternalWarning } from '@services/ws';
import { makeSingleton, Translate } from '@singletons';
import { AddonModSurveyOffline } from './survey-offline';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
const ROOT_CACHE_KEY = 'mmaModSurvey:';

View File

@ -23,7 +23,7 @@ import { CoreCourse } from '@features/course/services/course';
import { CoreUtils } from '@services/utils/utils';
import { CoreCourseLogHelper } from '@features/course/services/log-helper';
import { CoreError } from '@classes/errors/error';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
const ROOT_CACHE_KEY = 'mmaModUrl:';

View File

@ -28,7 +28,7 @@ import { CoreEvents } from '@singletons/events';
import { AddonModWikiPageDBRecord } from './database/wiki';
import { AddonModWikiOffline } from './wiki-offline';
import { AddonModWikiAutoSyncData, AddonModWikiManualSyncData, AddonModWikiSyncProvider } from './wiki-sync';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
const ROOT_CACHE_KEY = 'mmaModWiki:';

View File

@ -28,7 +28,7 @@ import { CoreFormFields } from '@singletons/form';
import { AddonModWorkshopOffline } from './workshop-offline';
import { AddonModWorkshopAutoSyncData, AddonModWorkshopSyncProvider } from './workshop-sync';
import { ADDON_MOD_WORKSHOP_COMPONENT } from '@addons/mod/workshop/constants';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
const ROOT_CACHE_KEY = 'mmaModWorkshop:';

View File

@ -22,7 +22,7 @@ import { CoreUtils } from '@services/utils/utils';
import { CoreWSExternalWarning } from '@services/ws';
import { makeSingleton, Translate } from '@singletons';
import { AddonNotesOffline } from './notes-offline';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
const ROOT_CACHE_KEY = 'mmaNotes:';

View File

@ -24,7 +24,7 @@ import { CoreLogger } from '@singletons/logger';
import { Translate, makeSingleton } from '@singletons';
import { CoreCourseModuleDelegate } from '@features/course/services/module-delegate';
import { AddonNotificationsPushNotification } from './handlers/push-click';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
declare module '@singletons/events' {

View File

@ -18,7 +18,7 @@ import { Subscription } from 'rxjs';
import { AsyncDirective } from './async-directive';
import { PageLoadsManager } from './page-loads-manager';
import { CorePromisedValue } from './promised-value';
import { WSObservable } from './sites/candidate-site';
import { WSObservable } from './sites/authenticated-site';
/**
* Class to watch requests from a page load (including requests from page sub-components).

View File

@ -48,7 +48,7 @@ import { CoreErrorLogs } from '@singletons/error-logs';
* Class that represents a site (combination of site + user) where the user has authenticated but the site hasn't been validated
* yet, it might be a site not supported by the app.
*/
export class CoreCandidateSite extends CoreUnauthenticatedSite {
export class CoreAuthenticatedSite extends CoreUnauthenticatedSite {
static readonly REQUEST_QUEUE_FORCE_WS = false; // Use "tool_mobile_call_external_functions" even for calling a single function.
@ -112,11 +112,11 @@ export class CoreCandidateSite extends CoreUnauthenticatedSite {
constructor(
siteUrl: string,
token: string,
otherData: CoreCandidateSiteOptionalData = {},
otherData: CoreAuthenticatedSiteOptionalData = {},
) {
super(siteUrl, otherData.publicConfig);
this.logger = CoreLogger.getInstance('CoreCandidateSite');
this.logger = CoreLogger.getInstance('CoreAuthenticaedSite');
this.token = token;
this.privateToken = otherData.privateToken;
}
@ -387,7 +387,7 @@ export class CoreCandidateSite extends CoreUnauthenticatedSite {
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
requestObservable<T = unknown>(method: string, data: any, preSets: CoreSiteWSPreSets): WSObservable<T> {
if (this.isLoggedOut() && !CoreCandidateSite.ALLOWED_LOGGEDOUT_WS.includes(method)) {
if (this.isLoggedOut() && !CoreAuthenticatedSite.ALLOWED_LOGGEDOUT_WS.includes(method)) {
// Site is logged out, it cannot call WebServices.
this.triggerSiteEvent(CoreEvents.SESSION_EXPIRED, {});
@ -879,7 +879,7 @@ export class CoreCandidateSite extends CoreUnauthenticatedSite {
const requests = this.requestQueue;
this.requestQueue = [];
if (requests.length == 1 && !CoreCandidateSite.REQUEST_QUEUE_FORCE_WS) {
if (requests.length == 1 && !CoreAuthenticatedSite.REQUEST_QUEUE_FORCE_WS) {
// Only one request, do a regular web service call.
try {
const data = await CoreWS.call(requests[0].method, requests[0].data, requests[0].wsPreSets);
@ -1329,8 +1329,9 @@ export class CoreCandidateSite extends CoreUnauthenticatedSite {
try {
const config = await this.requestPublicConfig();
this.saveToCache(method, {}, config, cachePreSets);
this.setPublicConfig(config);
if (cachePreSets.saveToCache) {
this.saveToCache(method, {}, config, cachePreSets);
}
return config;
} catch (error) {
@ -1453,9 +1454,9 @@ export class CoreCandidateSite extends CoreUnauthenticatedSite {
return 0;
}
if (CoreCandidateSite.MOODLE_RELEASES[data.major] === undefined) {
if (CoreAuthenticatedSite.MOODLE_RELEASES[data.major] === undefined) {
// Major version not found. Use the last one.
const major = Object.keys(CoreCandidateSite.MOODLE_RELEASES).pop();
const major = Object.keys(CoreAuthenticatedSite.MOODLE_RELEASES).pop();
if (!major) {
return 0;
}
@ -1463,7 +1464,7 @@ export class CoreCandidateSite extends CoreUnauthenticatedSite {
data.major = major;
}
return CoreCandidateSite.MOODLE_RELEASES[data.major] + data.minor;
return CoreAuthenticatedSite.MOODLE_RELEASES[data.major] + data.minor;
}
/**
@ -1493,7 +1494,7 @@ export class CoreCandidateSite extends CoreUnauthenticatedSite {
*/
protected getNextMajorVersionNumber(version: string): number {
const data = this.getMajorAndMinor(version);
const releases = Object.keys(CoreCandidateSite.MOODLE_RELEASES);
const releases = Object.keys(CoreAuthenticatedSite.MOODLE_RELEASES);
if (!data) {
// Invalid version.
@ -1504,10 +1505,10 @@ export class CoreCandidateSite extends CoreUnauthenticatedSite {
if (position == -1 || position == releases.length - 1) {
// Major version not found or it's the last one. Use the last one.
return CoreCandidateSite.MOODLE_RELEASES[releases[position]];
return CoreAuthenticatedSite.MOODLE_RELEASES[releases[position]];
}
return CoreCandidateSite.MOODLE_RELEASES[releases[position + 1]];
return CoreAuthenticatedSite.MOODLE_RELEASES[releases[position + 1]];
}
/**
@ -1517,9 +1518,9 @@ export class CoreCandidateSite extends CoreUnauthenticatedSite {
* @returns Expiration delay.
*/
getExpirationDelay(updateFrequency?: number): number {
updateFrequency = updateFrequency || CoreCandidateSite.FREQUENCY_USUALLY;
let expirationDelay = CoreCandidateSite.UPDATE_FREQUENCIES[updateFrequency] ||
CoreCandidateSite.UPDATE_FREQUENCIES[CoreCandidateSite.FREQUENCY_USUALLY];
updateFrequency = updateFrequency || CoreAuthenticatedSite.FREQUENCY_USUALLY;
let expirationDelay = CoreAuthenticatedSite.UPDATE_FREQUENCIES[updateFrequency] ||
CoreAuthenticatedSite.UPDATE_FREQUENCIES[CoreAuthenticatedSite.FREQUENCY_USUALLY];
if (CoreNetwork.isNetworkAccessLimited()) {
// Not WiFi, increase the expiration delay a 50% to decrease the data usage in this case.
@ -1609,9 +1610,9 @@ export function chainRequests<T, O extends ObservableInput<any>>(
}
/**
* Optional data to create a candidate site.
* Optional data to create an authenticated site.
*/
export type CoreCandidateSiteOptionalData = {
export type CoreAuthenticatedSiteOptionalData = {
privateToken?: string;
publicConfig?: CoreSitePublicConfigResponse;
};

View File

@ -51,13 +51,13 @@ import { map } from 'rxjs/operators';
import { firstValueFrom } from '../../utils/rxjs';
import { CoreFilepool } from '@services/filepool';
import { CoreSiteInfo } from './unauthenticated-site';
import { CoreCandidateSite, CoreCandidateSiteOptionalData, CoreSiteWSPreSets, WSObservable } from './candidate-site';
import { CoreAuthenticatedSite, CoreAuthenticatedSiteOptionalData, CoreSiteWSPreSets, WSObservable } from './authenticated-site';
/**
* Class that represents a site (combination of site + user).
* It will have all the site data and provide utility functions regarding a site.
*/
export class CoreSite extends CoreCandidateSite {
export class CoreSite extends CoreAuthenticatedSite {
id: string;
config?: CoreSiteConfig;
@ -920,7 +920,7 @@ export class CoreSite extends CoreCandidateSite {
/**
* Optional data to create a site.
*/
export type CoreSiteOptionalData = CoreCandidateSiteOptionalData & {
export type CoreSiteOptionalData = CoreAuthenticatedSiteOptionalData & {
info?: CoreSiteInfo;
config?: CoreSiteConfig;
loggedOut?: boolean;

View File

@ -23,7 +23,7 @@ import { makeSingleton } from '@singletons';
import { CoreEvents } from '@singletons/events';
import { CoreCommentsOffline } from './comments-offline';
import { CoreCommentsSyncAutoSyncData, CoreCommentsSyncProvider } from './comments-sync';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
const ROOT_CACHE_KEY = 'mmComments:';

View File

@ -55,7 +55,7 @@ import { SQLiteDB } from '@classes/sqlitedb';
import { CorePlatform } from '@services/platform';
import { asyncObservable, firstValueFrom } from '@/core/utils/rxjs';
import { map } from 'rxjs/operators';
import { CoreSiteWSPreSets, WSObservable } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets, WSObservable } from '@classes/sites/authenticated-site';
const ROOT_CACHE_KEY = 'mmCourse:';

View File

@ -24,7 +24,7 @@ import { CoreTimeUtils } from '@services/utils/time';
import { CoreUtils } from '@services/utils/utils';
import { CoreCourse, CoreCourseAnyModuleData, CoreCourseModuleContentFile } from './course';
import { CoreCache } from '@classes/cache';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import { CoreConstants } from '@/core/constants';
import { CoreDelegate, CoreDelegateHandler } from '@classes/delegate';
import { makeSingleton } from '@singletons';

View File

@ -29,7 +29,7 @@ import moment from 'moment-timezone';
import { of } from 'rxjs';
import { firstValueFrom, zipIncludingComplete } from '@/core/utils/rxjs';
import { catchError, map } from 'rxjs/operators';
import { chainRequests, WSObservable } from '@classes/sites/candidate-site';
import { chainRequests, WSObservable } from '@classes/sites/authenticated-site';
// Id for a course item representing all courses (for example, for course filters).
export const ALL_COURSES_ID = -1;

View File

@ -25,7 +25,7 @@ import { map } from 'rxjs/operators';
import { AddonEnrolGuest, AddonEnrolGuestInfo } from '@addons/enrol/guest/services/guest';
import { AddonEnrolSelf } from '@addons/enrol/self/services/self';
import { CoreEnrol, CoreEnrolEnrolmentInfo, CoreEnrolEnrolmentMethod } from '@features/enrol/services/enrol';
import { CoreSiteWSPreSets, WSObservable } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets, WSObservable } from '@classes/sites/authenticated-site';
const ROOT_CACHE_KEY = 'mmCourses:';

View File

@ -21,7 +21,7 @@ import { makeSingleton } from '@singletons';
import { CoreError } from '@classes/errors/error';
import { map } from 'rxjs/operators';
import { asyncObservable, firstValueFrom } from '@/core/utils/rxjs';
import { CoreSiteWSPreSets, WSObservable } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets, WSObservable } from '@classes/sites/authenticated-site';
const ROOT_CACHE_KEY = 'CoreCoursesDashboard:';

View File

@ -23,7 +23,7 @@ import { CoreFilterDelegate } from './filter-delegate';
import { makeSingleton } from '@singletons';
import { CoreEvents, CoreEventSiteData } from '@singletons/events';
import { CoreLogger } from '@singletons/logger';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
/**
* Service to provide filter functionalities.

View File

@ -18,7 +18,7 @@ import { CoreSites } from '@services/sites';
import { makeSingleton } from '@singletons';
import { CoreLogger } from '@singletons/logger';
import { CoreWSExternalWarning } from '@services/ws';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import { CoreError } from '@classes/errors/error';
import { SafeNumber } from '@/core/utils/types';

View File

@ -29,7 +29,7 @@ import { CoreH5PValidator } from '../classes/validator';
import { makeSingleton } from '@singletons';
import { CoreError } from '@classes/errors/error';
import { CorePath } from '@singletons/path';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
/**
* Service to provide H5P functionalities.

View File

@ -23,7 +23,7 @@ import { CoreWSExternalWarning } from '@services/ws';
import { makeSingleton } from '@singletons';
import { CoreEvents } from '@singletons/events';
import { CoreRatingOffline } from './rating-offline';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
const ROOT_CACHE_KEY = 'CoreRating:';

View File

@ -14,7 +14,7 @@
import { Injectable } from '@angular/core';
import { CoreError } from '@classes/errors/error';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import { CoreSites } from '@services/sites';
import { CoreWSExternalWarning } from '@services/ws';
import { makeSingleton } from '@singletons';

View File

@ -22,7 +22,7 @@ import { CoreCourses } from '../../courses/services/courses';
import { AddonModForum, AddonModForumData } from '@addons/mod/forum/services/forum';
import { CoreError } from '@classes/errors/error';
import { CoreBlockHelper } from '@features/block/services/block-helper';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
/**
* Items with index 1 and 3 were removed on 2.5 and not being supported in the app.

View File

@ -15,7 +15,7 @@
import { Input, OnInit, OnDestroy, ElementRef, Output, EventEmitter, Directive } from '@angular/core';
import { Subscription } from 'rxjs';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import { CoreSitePluginsPluginContentComponent } from '../components/plugin-content/plugin-content';
import { CoreSitePlugins } from '../services/siteplugins';
import { CoreLogger } from '@singletons/logger';

View File

@ -14,7 +14,7 @@
import { Component, OnInit, OnDestroy, Input, ViewChild, HostBinding } from '@angular/core';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import {
CoreCourseModuleSummaryResult,
CoreCourseModuleSummaryComponent,

View File

@ -27,7 +27,7 @@ import {
import { Subject } from 'rxjs';
import { Md5 } from 'ts-md5';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import { CoreCompileHtmlComponent } from '@features/compile/components/compile-html/compile-html';
import { CoreSitePlugins, CoreSitePluginsContent, CoreSitePluginsProvider } from '@features/siteplugins/services/siteplugins';
import { CoreNavigator } from '@services/navigator';

View File

@ -13,7 +13,7 @@
// limitations under the License.
import { Directive, Input, ElementRef, Optional } from '@angular/core';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import { CoreNavigator } from '@services/navigator';
import { CoreUtils } from '@services/utils/utils';
import { Md5 } from 'ts-md5';

View File

@ -15,7 +15,7 @@
import { Directive, Input, OnInit, ElementRef, Optional } from '@angular/core';
import { Md5 } from 'ts-md5';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import { CoreNavigator } from '@services/navigator';
import { CoreUtils } from '@services/utils/utils';
import { CoreSitePluginsPluginContentComponent } from '../components/plugin-content/plugin-content';

View File

@ -14,7 +14,7 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import { CoreSitePluginsContent } from '@features/siteplugins/services/siteplugins';
import { CanLeave } from '@guards/can-leave';
import { CoreNavigator } from '@services/navigator';

View File

@ -20,7 +20,7 @@ import { AddonModAssignSubmissionDelegate } from '@addons/mod/assign/services/su
import { AddonModQuizAccessRuleDelegate } from '@addons/mod/quiz/services/access-rules-delegate';
import { CoreDelegate, CoreDelegateHandler } from '@classes/delegate';
import { CoreError } from '@classes/errors/error';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import { CoreBlockDelegate } from '@features/block/services/block-delegate';
import { CoreCompile } from '@features/compile/services/compile';
import { CoreCourseOptionsDelegate } from '@features/course/services/course-options-delegate';

View File

@ -32,7 +32,7 @@ import { CoreSitePluginsModuleHandler } from '../classes/handlers/module-handler
import { CorePromisedValue } from '@classes/promised-value';
import { CorePlatform } from '@services/platform';
import { CoreEnrolAction, CoreEnrolInfoIcon } from '@features/enrol/services/enrol-delegate';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
const ROOT_CACHE_KEY = 'CoreSitePlugins:';

View File

@ -18,7 +18,7 @@ import { CoreSite } from '@classes/sites/site';
import { CoreWSExternalWarning } from '@services/ws';
import { makeSingleton, Translate } from '@singletons';
import { CoreError } from '@classes/errors/error';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
const ROOT_CACHE_KEY = 'CoreTag:';

View File

@ -16,7 +16,7 @@ import { CoreSite } from '@classes/sites/site';
import { CoreSites } from '@services/sites';
import { CoreUserSupportConfig } from './support-config';
import { CoreSiteConfigSupportAvailability } from '@classes/sites/unauthenticated-site';
import { CoreCandidateSite } from '@classes/sites/candidate-site';
import { CoreAuthenticatedSite } from '@classes/sites/authenticated-site';
/**
* Support config for an authenticated user.
@ -32,9 +32,9 @@ export class CoreUserAuthenticatedSupportConfig extends CoreUserSupportConfig {
return new CoreUserAuthenticatedSupportConfig(CoreSites.getRequiredCurrentSite());
}
private site: CoreSite | CoreCandidateSite;
private site: CoreSite | CoreAuthenticatedSite;
constructor(site: CoreSite | CoreCandidateSite) {
constructor(site: CoreSite | CoreAuthenticatedSite) {
super();
this.site = site;

View File

@ -28,7 +28,7 @@ import { CoreError } from '@classes/errors/error';
import { USERS_TABLE_NAME, CoreUserDBRecord } from './database/user';
import { CoreUserHelper } from './user-helper';
import { CoreUrlUtils } from '@services/utils/url';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
const ROOT_CACHE_KEY = 'mmUser:';

View File

@ -24,7 +24,7 @@ import { CoreXAPIItemAgent } from '../classes/item-agent';
import { CoreXAPIIRI } from '../classes/iri';
import { CoreError } from '@classes/errors/error';
import { CoreLogger } from '@singletons/logger';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
export const XAPI_STATE_DELETED = 'STATE_DELETED';

View File

@ -20,7 +20,7 @@ import { CoreError } from '@classes/errors/error';
import { makeSingleton, Translate } from '@singletons';
import { CoreWSExternalWarning } from '@services/ws';
import { CoreCourses } from '@features/courses/services/courses';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
const ROOT_CACHE_KEY = 'mmGroups:';

View File

@ -13,7 +13,7 @@
// limitations under the License.
import { Injectable } from '@angular/core';
import { CoreCandidateSite, CoreCandidateSiteOptionalData } from '@classes/sites/candidate-site';
import { CoreAuthenticatedSite, CoreAuthenticatedSiteOptionalData } from '@classes/sites/authenticated-site';
import { CoreSite, CoreSiteOptionalData } from '@classes/sites/site';
import { CoreUnauthenticatedSite, CoreSitePublicConfigResponse } from '@classes/sites/unauthenticated-site';
@ -26,7 +26,7 @@ import { makeSingleton } from '@singletons';
export class CoreSitesFactoryService {
/**
* Make a site object.
* Create a site instance.
*
* @param id Site ID.
* @param siteUrl Site URL.
@ -44,15 +44,15 @@ export class CoreSitesFactoryService {
}
/**
* Create a candidate site instance.
* Create an authenticated site instance.
*
* @param siteUrl Site URL.
* @param token Site's WS token.
* @param options Other options.
* @returns Candidate site instance.
* @returns Authenticated site instance.
*/
makeCandidateSite(siteUrl: string, token: string, options: CoreCandidateSiteOptionalData = {}): CoreCandidateSite {
return new CoreCandidateSite(siteUrl, token, options);
makeAuthenticatedSite(siteUrl: string, token: string, options: CoreAuthenticatedSiteOptionalData = {}): CoreAuthenticatedSite {
return new CoreAuthenticatedSite(siteUrl, token, options);
}
/**

View File

@ -64,7 +64,7 @@ import { CoreContentLinksHelper } from '@features/contentlinks/services/contentl
import { CoreAutoLogoutType, CoreAutoLogout } from '@features/autologout/services/autologout';
import { CoreCacheManager } from '@services/cache-manager';
import { CoreSiteInfo, CoreSiteInfoResponse, CoreSitePublicConfigResponse } from '@classes/sites/unauthenticated-site';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
export const CORE_SITE_SCHEMAS = new InjectionToken<CoreSiteSchema[]>('CORE_SITE_SCHEMAS');
export const CORE_SITE_CURRENT_SITE_ID_CONFIG = 'current_site_id';
@ -514,12 +514,12 @@ export class CoreSitesProvider {
login = true;
}
// Create a "candidate" site to fetch the site info.
const candidateSite = CoreSitesFactory.makeCandidateSite(siteUrl, token, { privateToken });
// Validate the site.
const authSite = CoreSitesFactory.makeAuthenticatedSite(siteUrl, token, { privateToken });
let isNewSite = true;
try {
const info = await candidateSite.fetchSiteInfo();
const info = await authSite.fetchSiteInfo();
const result = this.isValidMoodleVersion(info);
if (result !== CoreSitesProvider.VALID_VERSION) {
@ -572,7 +572,6 @@ export class CoreSitesProvider {
this.sites[siteId] = site;
if (login) {
// Turn candidate site into current site.
this.currentSite = site;
// Store session.
await this.login(siteId);

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import { CoreSiteWSPreSets, WSObservable } from '@classes/sites/candidate-site';
import { CoreSiteWSPreSets, WSObservable } from '@classes/sites/authenticated-site';
import { CoreSite, CoreSiteConfigResponse } from '@classes/sites/site';
import { CoreSiteInfo } from '@classes/sites/unauthenticated-site';
import { of } from 'rxjs';