Fix JSDoc issues

Fix missing documentation for parameters and return types, incorect
config and errors in type definitions.
This commit is contained in:
Hornwitser committed 2020-06-17 20:53:18 +02:00
1 parent 3dba92a03d
commit 703fda43ad
20 files changed
+193 -52

No files matched your search

+6 -3
View File
@@ -95,6 +95,7 @@ class Role {
*
* Ensures the role with id 0 exisits and has the core.admin permission.
*
* @param {Map<number, module:lib/user.Role>} roles - role storage to modify.
* @returns {module:lib/permission.Role} the default admin role
* @static
*/
@@ -115,7 +116,7 @@ function ensureDefaultAdminRole(roles) {
* assigned by default. Note that this may not be the same role as the one
* that is assigned to new users by default.
*
* @returns {module:lib/permission.Role} the default player role
* @param {Map<number, module:lib/user.Role>} roles - role storage to modify.
* @static
*/
function ensureDefaultPlayerRole(roles) {
@@ -156,7 +157,7 @@ class User {
/**
* Roles this user has
* @type {Set<module:lib/permissions.Role}
* @type {Set<module:lib/permissions.Role>}
*/
this.roles = new Set();
if (roles) {
@@ -186,6 +187,7 @@ class User {
* Generate access token for this user
*
* @param {string} secret - Secret to sign token with.
* @returns {string} JWT access token for the user.
*/
createToken(secret) {
return jwt.sign({ aud: "user", user: this.name }, secret);
@@ -197,7 +199,7 @@ class User {
* Sets the tokenValidAfter property to the current time, which causes
* all currently issued tokens for the user to become invalid.
*/
invalidateToken(secret) {
invalidateToken() {
this.tokenValidAfter = Math.floor(Date.now() / 1000);
}
@@ -208,6 +210,7 @@ class User {
* permission. If the permission is not granted for the user a
* "Permission denied" error is thrown.
*
* @param {string} permission - The permission to check for.
* @throws {Error} if the user does noh have the given permission.
*/
checkPermission(permission) {