Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

meteor-become

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

meteor-become

Allow a user of a Meteor application to act as another one

  • 0.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7
decreased by-77.42%
Maintainers
1
Weekly downloads
 
Created
Source

Allow a user of a Meteor application to act as another one.

Example

import { Become } from 'meteor-become'

Become.policy(function(fromUser, toUser) {
    return toUser.username.indexOf("quatrava") >= 0
});

if (Meteor.isClient) {
    Template.MyBecomeUserForm.events({
        "submit": function(event, target) {
            Become.become(anotherUserID);
            event.stopPropagation();
        }
    });
}

How It Works

  1. Client code calls Become.become()
  2. Become.become() saves the current session token and calls the Meteor login function
  3. Server checks policy function (set with Become.policy) and returns success or error to client
  4. Upon success, Meteor.userId() etc. get updated on the client as is normal upon Meteor login
  5. Client may now call Become.restore() to restore the previous session token and reconnect

Dependencies

This code only works if called from a Meteor application. Furthermore, the following Meteor core packages are required (add them with meteor add if needed):

  • promise
  • session
  • tracker

API Reference

Start with the Become object (available on client and server)

Keywords

FAQs

Package last updated on 25 Nov 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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