Skip to content

Commit

Permalink
docs: changed ctx description on jsdoc comments
Browse files Browse the repository at this point in the history
Fixes #1218
  • Loading branch information
brecke committed Dec 14, 2021
1 parent 53c84e3 commit 5f1f323
Show file tree
Hide file tree
Showing 59 changed files with 323 additions and 327 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const log = logger('oae-script-main');
* Disable users from the system by updating the deleted flag
*
* @function doMigration
* @param {Context} ctx Standard context object containing the current user and the current tenant
* @param {Context} ctx Current execution context
* @param {String} tenantAlias Tenant alias we want to delete users from
* @param {Function} callback Standard callback function
*/
Expand Down
12 changes: 6 additions & 6 deletions packages/oae-activity/lib/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ const registerActivityEntityAssociation = function (activityEntityType, associat
/**
* Get the activity stream for a principal
*
* @param {Context} ctx Standard context object containing the current user and the current tenant
* @param {Context} ctx Current execution context
* @param {String} principalId The ID of the user for which the activity stream should be retrieved
* @param {String} [start] Determines the point at which activities are returned for paging purposes. If not provided, the first x elements will be returned
* @param {Number} [limit] The maximum number of activities to return. Default: 25
Expand Down Expand Up @@ -583,7 +583,7 @@ const getActivityStream = function (ctx, principalId, start, limit, transformerT
/**
* Get the notification stream for a user
*
* @param {Context} ctx Standard context object containing the current user and the current tenant
* @param {Context} ctx Current execution context
* @param {String} userId The ID of the user for which the notifications should be retrieved
* @param {String} [start] Determines the point at which activities are returned for paging purposes. If not provided, the first x elements will be returned
* @param {Number} [limit] The maximum number of activities to return. Default: 25
Expand Down Expand Up @@ -629,7 +629,7 @@ const getNotificationStream = function (ctx, userId, start, limit, transformerTy
/**
* Mark all notifications for the current user as read
*
* @param {Context} ctx Standard context object containing the current user and the current tenant
* @param {Context} ctx Current execution context
* @param {Function} callback Standard callback function
* @param {Object} callback.err An error that occurred, if any
*/
Expand All @@ -648,15 +648,15 @@ const markNotificationsRead = function (ctx, callback) {

/**
* @function isActivityFeedDisabled
* @param {Context} ctx Standard context object containing the current user and the current tenant
* @param {Context} ctx Current execution context
* @return {Boolean|String|Number|Object} cachedConfiguration The requested config value e.g. `true`. This will be null if the config element cannot be found
*/
const isActivityFeedDisabled = (ctx) => !ActivityConfig.getValue(ctx.tenant().alias, 'activity', 'enabled');

/**
* Post an activity in the system to be routed.
*
* @param {Context} ctx Standard context object containing the current user and the current tenant
* @param {Context} ctx Current execution context
* @param {ActivitySeed} activitySeed The activity "seed" object, which represents the smallest amount of information necessary to generate an activity
* @param {Function} callback Standard callback function
* @param {Object} callback.err An error that occurred, if any
Expand Down Expand Up @@ -747,7 +747,7 @@ const postActivity = function (ctx, activitySeed, callback) {
/**
* Internal function to get an activity stream by its ID. This bypasses permission checks.
*
* @param {Context} ctx Standard context object containing the current user and the current tenant
* @param {Context} ctx Current execution context
* @param {String} activtyStreamId The ID of the activity stream to fetch. ex: `u:cam:abc123#activity`
* @param {Number} start Determines the point at which activities are returned for paging purposes. If not provided, the first x elements will be returned
* @param {Number} limit The number of activities to fetch
Expand Down
2 changes: 1 addition & 1 deletion packages/oae-activity/lib/internal/transformer.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const log = logger('oae-activity-push');
/**
* Given an array of persistent activities from a stream, convert them into activities suitable to be delivered to the UI.
*
* @param {Context} ctx Standard context object containing the current user and the current tenant
* @param {Context} ctx Current execution context
* @param {Object[]} activities The array of persistent activities to transform. These activities will be modified in-place. The specific model of each activity entity is proprietary to the custom producer and transformer that persist and convert the entities.
* @param {String} [transformerType] The type of transformer to retrieve. One of `ActivityConstants.transformerTypes`. Defaults to `activitystreams`
* @param {Function} callback Standard callback function
Expand Down
26 changes: 13 additions & 13 deletions packages/oae-authentication/lib/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ const init = function (_globalTenantAlias) {
/**
* Determine if a local username already exists
*
* @param {Context} ctx Standard context object containing the current user and the current tenant
* @param {Context} ctx Current execution context
* @param {String} [tenantAlias] The alias of the tenant on which to check for existence. Defaults to the current tenant
* @param {String} username The username to check existence for
* @param {Function} callback Standard callback function
Expand Down Expand Up @@ -203,7 +203,7 @@ const localUsernameExists = function (ctx, tenantAlias, username, callback) {
* create a private user with the provided username, password and profile information and make them
* a global admin
*
* @param {Context} ctx Standard context object containing the current user and the current tenant
* @param {Context} ctx Current execution context
* @param {String} username The unique username for the global administrator
* @param {String} password The password for the global administrator
* @param {String} displayName The display name for the global administrator
Expand Down Expand Up @@ -307,7 +307,7 @@ const getOrCreateGlobalAdminUser = function (
/**
* Utility methods that gets a user by the login id. If the user doesn't exist yet, it will be created.
*
* @param {Context} ctx Standard context object containing the current user and the current tenant
* @param {Context} ctx Current execution context
* @param {String} authProvider The authentication provider of the login id
* @param {String} externalId The desired externalId/username for this user
* @param {String} displayName The display name for the user
Expand Down Expand Up @@ -357,7 +357,7 @@ const getOrCreateUser = function (
/**
* Create a user with the given login id if no user exists for it yet
*
* @param {Context} ctx Standard context object containing the current user and the current tenant
* @param {Context} ctx Current execution context
* @param {LoginId} loginId The login id to use to fetch or create the user
* @param {String} displayName The display name for the user
* @param {Object} [opts] Optional user profile parameters
Expand Down Expand Up @@ -490,7 +490,7 @@ const _getOrCreateUser = function (ctx, loginId, displayName, options, callback)
/**
* Validate that an email address belongs to the tenant in context
*
* @param {Context} ctx Standard context object containing the current user and the current tenant
* @param {Context} ctx Current execution context
* @param {String} email The email address to validate
* @param {Function} callback Standard callback function
* @param {Object} callback.err An error that occurred, if any
Expand Down Expand Up @@ -522,7 +522,7 @@ const _validateEmailBelongsToTenant = function (ctx, email, callback) {
/**
* Create a private tenant administrator user with the provided login id
*
* @param {Context} ctx Standard context object containing the current user and the current tenant
* @param {Context} ctx Current execution context
* @param {LoginId} loginId The login id that will be associated with the tenant administrator so they may log in
* @param {String} displayName The display name for the tenant administrator
* @param {Object} [opts] Optional user profile parameters
Expand Down Expand Up @@ -603,7 +603,7 @@ const createTenantAdminUser = function (ctx, loginId, displayName, options, call
/**
* Create a user with the provided login id
*
* @param {Context} ctx Standard context object containing the current user and the current tenant
* @param {Context} ctx Current execution context
* @param {LoginId} loginId The login id that will be associated with the user so they may log in
* @param {String} displayName The display name for the user
* @param {Object} [opts] Optional user profile parameters
Expand Down Expand Up @@ -665,7 +665,7 @@ const createUser = function (ctx, loginId, displayName, options, callback) {
* Internal utility function to create a user. Validation on inputs should be performed before
* calling this function
*
* @param {Context} ctx Standard context object containing the current user and the current tenant
* @param {Context} ctx Current execution context
* @param {LoginId} loginId The login id that will be associated with the user so they may log in
* @param {String} displayName The display name for the user
* @param {Object} [opts] Optional user profile parameters
Expand Down Expand Up @@ -749,7 +749,7 @@ const _createUser = function (ctx, loginId, displayName, options, callback) {
* Associate the given Login ID info to the specified user. This makes it possible for the associated user to login with the provided
* login credentials.
*
* @param {Context} ctx Standard context object containing the current user and the current tenant
* @param {Context} ctx Current execution context
* @param {LoginId} loginId The login id to associate to the user
* @param {String} userId The id of the user to which to associate the login id
* @param {Function} callback Standard callback function
Expand Down Expand Up @@ -840,7 +840,7 @@ const associateLoginId = function (ctx, loginId, userId, callback) {
/**
* Change a user's local password
*
* @param {Context} ctx Standard context object containing the current user and the current tenant
* @param {Context} ctx Current execution context
* @param {String} userId The id of user for which to change the local password
* @param {String} [oldPassword] The previous password for the user. This is only required when the current user is not an administrator
* @param {String} newPassword The new password for the user
Expand Down Expand Up @@ -1015,7 +1015,7 @@ const getUserIdFromLoginId = function (tenantAlias, provider, externalId, callba
/**
* Get the secret for an existing user's resetpassword request
*
* @param {Context} ctx Standard context object containing the current user and the current tenant
* @param {Context} ctx Current execution context
* @param {String} userName The user's own unique username
* @param {Function} callback Standard callback function
* @param {Object} callback.err An error that occurred, if any
Expand Down Expand Up @@ -1085,7 +1085,7 @@ const getResetPasswordSecret = function (ctx, username, callback) {
/**
* Reset the password for an user with an existing username and a valid token
*
* @param {Context} ctx Standard context object containing the current user and the current tenant
* @param {Context} ctx Current execution context
* @param {String} userName The user's own unique username
* @param {String} token The token that user generated within 24 hours
* @param {String} newPassword The new password for the user
Expand Down Expand Up @@ -1226,7 +1226,7 @@ const _associateLoginId = function (loginId, userId, callback) {
/**
* Get the login ids that are mapped to a user.
*
* @param {Context} ctx Standard context object containing the current user and the current tenant
* @param {Context} ctx Current execution context
* @param {String} userId The id of the user
* @param {Function} callback Standard callback function
* @param {Object} callback.err An error that occurred, if any
Expand Down
8 changes: 4 additions & 4 deletions packages/oae-authentication/lib/strategies/oauth/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const { unless, isLoggedInUser, isUserId, isNotEmpty } = validator;
/**
* Get all OAuth clients for a user
*
* @param {Context} ctx Standard context object containing the current user and the current tenant
* @param {Context} ctx Current execution context
* @param {String} userId The id of the user for which to get the available OAuth clients
* @param {Function} callback Standard callback function
* @param {Object} callback.err An error that occurred, if any
Expand Down Expand Up @@ -69,7 +69,7 @@ const getClients = function (ctx, userId, callback) {
* They can create a client *for another* user if they choose to do so. The access associated to
* that client will be the full access of the user for which you've created the client.
*
* @param {Context} ctx Standard context object containing the current user and the current tenant
* @param {Context} ctx Current execution context
* @param {String} userId The id of the user for which to create an OAuth client
* @param {String} displayName The name of the OAuth client
* @param {Function} callback Standard callback function
Expand Down Expand Up @@ -111,7 +111,7 @@ const createClient = function (ctx, userId, displayName, callback) {
/**
* Update an OAuth client
*
* @param {Context} ctx Standard context object containing the current user and the current tenant
* @param {Context} ctx Current execution context
* @param {String} clientId The id of the OAuth client to update
* @param {String} displayName The updated name for the OAuth client
* @param {String} secret The updated secret for the OAuth client
Expand Down Expand Up @@ -170,7 +170,7 @@ const updateClient = function (ctx, clientId, displayName, secret, callback) {
/**
* Delete an OAuth client
*
* @param {Context} ctx Standard context object containing the current user and the current tenant
* @param {Context} ctx Current execution context
* @param {String} clientId The id of the OAuth client to delete
* @param {Function} callback Standard callback function
* @param {Object} callback.err An error that occurred, if any
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const isEnabled = function (tenantAlias) {
/**
* Get the url to the Shibboleth Service Provider.
*
* @param {Context} ctx Standard context object containing the current user and the current tenant
* @param {Context} ctx Current execution context
* @return {String} The URL to the Shibboleth Service Provider
*/
const getServiceProviderUrl = function (ctx) {
Expand Down
6 changes: 3 additions & 3 deletions packages/oae-authentication/lib/strategies/signed/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const TIME_1_MINUTE_IN_SECONDS = 60;
/**
* Create request information that a global administrator can use to authenticate as themself to a particular tenant.
*
* @param {Context} ctx Standard context object containing the current user and the current tenant
* @param {Context} ctx Current execution context
* @param {String} tenantAlias The target tenant alias to which the global admin is trying to authenticate
* @param {Function} callback Standard callback function
* @param {Object} callback.err An error that occurred, if any
Expand Down Expand Up @@ -88,7 +88,7 @@ const getSignedTenantAuthenticationRequest = function (ctx, tenantAlias, callbac
/**
* Create request information that an administrator can use to authenticate themself as a different user.
*
* @param {Context} ctx Standard context object containing the current user and the current tenant
* @param {Context} ctx Current execution context
* @param {String} becomeUserId The id of the user the administrator is requesting to become
* @param {Function} callback Standard callback function
* @param {Object} callback.err An error that occurred, if any
Expand Down Expand Up @@ -171,7 +171,7 @@ const getSignedBecomeUserAuthenticationRequest = function (ctx, becomeUserId, ca
/**
* Verify the authenticity of a signed authentication request
*
* @param {Context} ctx Standard context object containing the current user and the current tenant
* @param {Context} ctx Current execution context
* @param {Object} body The POST data that was sent with the request
* @param {Function} callback Standard callback function
* @param {Object} callback.err An error that occurred, if any
Expand Down
4 changes: 2 additions & 2 deletions packages/oae-authz/lib/invitations/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { Invitation } from 'oae-authz/lib/invitations/model.js';
/**
* Get all the invitations for the specified resource
*
* @param {Context} ctx Standard context object containing the current user and the current tenant
* @param {Context} ctx Current execution context
* @param {Resource} resource The resource for which to fetch invitations
* @param {Function} callback Standard callback function
* @param {Object} callback.err An error that occurred, if any
Expand Down Expand Up @@ -55,7 +55,7 @@ const getAllInvitations = function (ctx, resource, callback) {
/**
* Convert all the invitation hashes into a full invitation model object
*
* @param {Context} ctx Standard context object containing the current user and the current tenant
* @param {Context} ctx Current execution context
* @param {Resource} resource The resource for which to convert the invitation hashes
* @param {Object[]} invitationHashes The list of invitation storage hashes to convert
* @param {Function} callback Standard callback function
Expand Down
2 changes: 1 addition & 1 deletion packages/oae-authz/lib/permissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import * as TenantsUtil from 'oae-tenants/lib/util.js';
/**
* Determine which of all potential permissions a user has
*
* @param {Context} ctx Standard context object containing the current user and the current tenant
* @param {Context} ctx Current execution context
* @param {Resource} resource The resource on which we are determining permissions
* @param {Function} callback Standard callback function
* @param {Object} callback.err An error that occurred, if any
Expand Down
Loading

0 comments on commit 5f1f323

Please sign in to comment.