New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

enonic-fp

Package Overview
Dependencies
Maintainers
1
Versions
99
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

enonic-fp - npm Package Compare versions

Comparing version 0.2.37 to 0.2.38

81

lib/auth.d.ts
import { IOEither } from "fp-ts/lib/IOEither";
import { Option } from "fp-ts/lib/Option";
import { EnonicError } from "./errors";
import { CreateGroupParams, CreateRoleParams, CreateUserParams, FindUsersParams, Group, LoginParams, LoginResult, ModifyUserParams, Principal, Role, User, UserQueryResult } from "enonic-types/lib/auth";
import { ChangePasswordParams, CreateGroupParams, CreateRoleParams, CreateUserParams, FindPrincipalsParams, FindPrincipalsResult, FindUsersParams, GetProfileParams, Group, LoginParams, LoginResult, ModifyGroupParams, ModifyProfileParams, ModifyRoleParams, ModifyUserParams, Principal, Role, User, UserQueryResult } from "enonic-types/lib/auth";
/**
* Login a user through the specified idProvider, with userName and password.
*/
export declare function login(params: LoginParams): IOEither<EnonicError, LoginResult>;
/**
* Logout the currently logged-in user.
*/
export declare function logout(): IOEither<EnonicError, void>;
/**
* Changes password for specified user.
*/
export declare function changePassword(params: ChangePasswordParams): IOEither<EnonicError, void>;
/**
* Generates a random secure password that may be suggested to a user.
*/
export declare function generatePassword(): string;
/**
* Returns the logged-in user. If not logged-in, this will return undefined or null.
*/
export declare function getUser(): Option<User>;
/**
* Returns the profile of a user.
*/
export declare function getProfile<A>(params: GetProfileParams): IOEither<EnonicError, void>;
/**
* This function retrieves the profile of a user and updates it.
*/
export declare function modifyProfile<A>(params: ModifyProfileParams<A>): IOEither<EnonicError, void>;
/**
* This function returns the ID provider configuration. It is meant to be called from an ID provider controller.
*/
export declare function getIdProviderConfig<A>(): Option<A>;
/**
* Search for users matching the specified query.
*/
export declare function findUsers<A>(params: FindUsersParams): IOEither<EnonicError, UserQueryResult<A>>;
/**
* Retrieves the user specified and updates it with the changes applied through the editor.
*/
export declare function modifyUser(params: ModifyUserParams): IOEither<EnonicError, User>;
/**
* Creates a user.
*/
export declare function createUser(params: CreateUserParams): IOEither<EnonicError, User>;
/**
* Adds members to a principal (user or role).
*/
export declare function addMembers(principalKey: string, members: ReadonlyArray<string>): IOEither<EnonicError, void>;
/**
* Removes members from a principal (group or role).
*/
export declare function removeMembers(principalKey: string, members: ReadonlyArray<string>): IOEither<EnonicError, void>;
/**
* Deletes the principal with the specifkey.
*/
export declare function deletePrincipal(principalKey: string): IOEither<EnonicError, boolean>;
/**
* Search for principals matching the specified criteria.
*/
export declare function findPrincipals(params: FindPrincipalsParams): IOEither<EnonicError, FindPrincipalsResult>;
/**
* Returns the principal with the specified key.
*/
export declare function getPrincipal(principalKey: string): Option<User>;
/**
* Creates a role.
*/
export declare function createRole(params: CreateRoleParams): IOEither<EnonicError, Role>;
/**
* Checks if the logged-in user has the specified role.
*/
export declare function hasRole(role: string): IOEither<EnonicError, boolean>;
/**
* Retrieves the role specified and updates it with the changes applied through an editor.
*/
export declare function modifyRole(params: ModifyRoleParams): IOEither<EnonicError, Role>;
/**
* Creates a group.
*/
export declare function createGroup(params: CreateGroupParams): IOEither<EnonicError, Group>;
/**
* Retrieves the group specified and updates it with the changes applied.
*/
export declare function modifyGroup(params: ModifyGroupParams): IOEither<EnonicError, Group>;
/**
* Returns a list of principals that are members of the specified principal.
*/
export declare function getMembers(principalKey: string): IOEither<EnonicError, ReadonlyArray<User>>;
/**
* Returns the list of principals which the specified principal is a member of.
*/
export declare function getMemberships(principalKey: string, transitive?: boolean): IOEither<EnonicError, ReadonlyArray<Principal>>;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getMemberships = exports.createGroup = exports.createRole = exports.getPrincipal = exports.removeMembers = exports.addMembers = exports.createUser = exports.modifyUser = exports.findUsers = exports.getIdProviderConfig = exports.getUser = exports.logout = exports.login = void 0;
exports.getMemberships = exports.getMembers = exports.modifyGroup = exports.createGroup = exports.modifyRole = exports.hasRole = exports.createRole = exports.getPrincipal = exports.findPrincipals = exports.deletePrincipal = exports.removeMembers = exports.addMembers = exports.createUser = exports.modifyUser = exports.findUsers = exports.getIdProviderConfig = exports.modifyProfile = exports.getProfile = exports.getUser = exports.generatePassword = exports.changePassword = exports.logout = exports.login = void 0;
var Option_1 = require("fp-ts/lib/Option");
var utils_1 = require("./utils");
var auth = __non_webpack_require__("/lib/xp/auth");
/**
* Login a user through the specified idProvider, with userName and password.
*/
function login(params) {

@@ -11,2 +14,5 @@ return utils_1.catchEnonicError(function () { return auth.login(params); });

exports.login = login;
/**
* Logout the currently logged-in user.
*/
function logout() {

@@ -16,2 +22,19 @@ return utils_1.catchEnonicError(function () { return auth.logout(); });

exports.logout = logout;
/**
* Changes password for specified user.
*/
function changePassword(params) {
return utils_1.catchEnonicError(function () { return auth.changePassword(params); });
}
exports.changePassword = changePassword;
/**
* Generates a random secure password that may be suggested to a user.
*/
function generatePassword() {
return auth.generatePassword();
}
exports.generatePassword = generatePassword;
/**
* Returns the logged-in user. If not logged-in, this will return undefined or null.
*/
function getUser() {

@@ -21,2 +44,19 @@ return Option_1.fromNullable(auth.getUser());

exports.getUser = getUser;
/**
* Returns the profile of a user.
*/
function getProfile(params) {
return utils_1.catchEnonicError(function () { return auth.getProfile(params); });
}
exports.getProfile = getProfile;
/**
* This function retrieves the profile of a user and updates it.
*/
function modifyProfile(params) {
return utils_1.catchEnonicError(function () { return auth.modifyProfile(params); });
}
exports.modifyProfile = modifyProfile;
/**
* This function returns the ID provider configuration. It is meant to be called from an ID provider controller.
*/
function getIdProviderConfig() {

@@ -26,2 +66,5 @@ return Option_1.fromNullable(auth.getIdProviderConfig());

exports.getIdProviderConfig = getIdProviderConfig;
/**
* Search for users matching the specified query.
*/
function findUsers(params) {

@@ -31,2 +74,5 @@ return utils_1.catchEnonicError(function () { return auth.findUsers(params); });

exports.findUsers = findUsers;
/**
* Retrieves the user specified and updates it with the changes applied through the editor.
*/
function modifyUser(params) {

@@ -36,2 +82,5 @@ return utils_1.catchEnonicError(function () { return auth.modifyUser(params); });

exports.modifyUser = modifyUser;
/**
* Creates a user.
*/
function createUser(params) {

@@ -41,2 +90,5 @@ return utils_1.catchEnonicError(function () { return auth.createUser(params); });

exports.createUser = createUser;
/**
* Adds members to a principal (user or role).
*/
function addMembers(principalKey, members) {

@@ -46,2 +98,5 @@ return utils_1.catchEnonicError(function () { return auth.addMembers(principalKey, members); });

exports.addMembers = addMembers;
/**
* Removes members from a principal (group or role).
*/
function removeMembers(principalKey, members) {

@@ -51,2 +106,19 @@ return utils_1.catchEnonicError(function () { return auth.removeMembers(principalKey, members); });

exports.removeMembers = removeMembers;
/**
* Deletes the principal with the specifkey.
*/
function deletePrincipal(principalKey) {
return utils_1.catchEnonicError(function () { return auth.deletePrincipal(principalKey); });
}
exports.deletePrincipal = deletePrincipal;
/**
* Search for principals matching the specified criteria.
*/
function findPrincipals(params) {
return utils_1.catchEnonicError(function () { return auth.findPrincipals(params); });
}
exports.findPrincipals = findPrincipals;
/**
* Returns the principal with the specified key.
*/
function getPrincipal(principalKey) {

@@ -56,2 +128,5 @@ return Option_1.fromNullable(auth.getPrincipal(principalKey));

exports.getPrincipal = getPrincipal;
/**
* Creates a role.
*/
function createRole(params) {

@@ -61,2 +136,19 @@ return utils_1.catchEnonicError(function () { return auth.createRole(params); });

exports.createRole = createRole;
/**
* Checks if the logged-in user has the specified role.
*/
function hasRole(role) {
return utils_1.catchEnonicError(function () { return auth.hasRole(role); });
}
exports.hasRole = hasRole;
/**
* Retrieves the role specified and updates it with the changes applied through an editor.
*/
function modifyRole(params) {
return utils_1.catchEnonicError(function () { return auth.modifyRole(params); });
}
exports.modifyRole = modifyRole;
/**
* Creates a group.
*/
function createGroup(params) {

@@ -66,2 +158,19 @@ return utils_1.catchEnonicError(function () { return auth.createGroup(params); });

exports.createGroup = createGroup;
/**
* Retrieves the group specified and updates it with the changes applied.
*/
function modifyGroup(params) {
return utils_1.catchEnonicError(function () { return auth.modifyGroup(params); });
}
exports.modifyGroup = modifyGroup;
/**
* Returns a list of principals that are members of the specified principal.
*/
function getMembers(principalKey) {
return utils_1.catchEnonicError(function () { return auth.getMembers(principalKey); });
}
exports.getMembers = getMembers;
/**
* Returns the list of principals which the specified principal is a member of.
*/
function getMemberships(principalKey, transitive) {

@@ -68,0 +177,0 @@ return utils_1.catchEnonicError(function () { return auth.getMemberships(principalKey, transitive); });

12

package.json
{
"name": "enonic-fp",
"version": "0.2.37",
"version": "0.2.38",
"description": "Functional programming helpers for Enonic XP",

@@ -28,12 +28,12 @@ "main": "lib/index.js",

"dependencies": {
"enonic-types": "^0.0.52",
"fp-ts": "^2.6.0"
"enonic-types": "^0.0.54",
"fp-ts": "^2.6.1"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^2.33.0",
"@typescript-eslint/parser": "^2.33.0",
"@typescript-eslint/eslint-plugin": "^2.34.0",
"@typescript-eslint/parser": "^2.34.0",
"eslint": "^7.0.0",
"rimraf": "^3.0.2",
"typescript": "^3.9.2"
"typescript": "^3.9.3"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc