Giter VIP home page Giter VIP logo

meteor-accounts-admin-ui-bootstrap-3's Introduction

Accounts Admin UI (Bootstrap 3)

A roles based account management system using bootstrap 3 for Meteor.

Table of Contents

TODO

  • Implement UI to create/remove roles (currently done at Meteor.startup) DONE
  • Configurable fields
  • Implement pagination (currently relies on search to find users)
  • Write tests
  • User impersonation (for admins)

History

Latest Version: 0.2.6

  • Remove hard dependency to bootstrap-3 (so less-bootstrap-3 or similar can be used). (Thanks to @johnm)
  • Documentation updates
  • Fixes Issue #18

Version: 0.2.5

  • Bump roles version; v1.2.8 is Blaze-compatible (thanks to @alanning!)

Version: 0.2.4

Version: 0.2.3

  • Now supports changing usernames from admin interface (thanks to @djkmiles!)

Version: 0.2.2

  • Fixed bugs due to fallout from removing bootstrap-modal

Version: 0.2.1

  • Removed dependency to bootstrap-modal

Version: 0.2.0

  • Added UI to create/remove roles

Version: 0.1.0

  • Created a basic UI to find users, delete users, and modify roles.

Quick Start

Set up a simple admin page

$ mrt create app
$ cd app
$ mrt add bootstrap-3		# or mrt add less-bootstrap-3
$ mrt add accounts-password
$ mrt add roles
$ mrt add accounts-ui-bootstrap-3
$ mrt add accounts-admin-ui-bootstrap-3
$ mrt remove autopublish
$ mrt remove insecure

app.js

if (Meteor.isServer) {
	Meteor.startup(function () {
		// bootstrap the admin user if they exist -- You'll be replacing the id later
		if (Meteor.users.findOne("your_admin_user_id"))
			Roles.addUsersToRoles("your_admin_user_id", ['admin']);

		// create a couple of roles if they don't already exist (THESE ARE NOT NEEDED -- just for the demo)
		if(!Meteor.roles.findOne({name: "secret"}))
            Roles.createRole("secret");

        if(!Meteor.roles.findOne({name: "double-secret"}))
            Roles.createRole("double-secret");
	});
}

if (Meteor.isClient) {
	Template.adminTemplate.helpers({
		// check if user is an admin
		isAdminUser: function() {
			return Roles.userIsInRole(Meteor.user(), ['admin']);
		}
	})
}

app.html

<head>
  <title>Accounts Admin</title>
</head>

<body>
	<div class="navbar navbar-default" role="navigation">
        <div class="navbar-header">
            <div class="navbar-header">
                <a class="navbar-brand" href="/">Accounts Admin</a>
            </div>
        </div>
        <div class="navbar-collapse collapse">
            <ul class="nav navbar-nav">  
            </ul>
            <ul class="nav navbar-nav navbar-right">
            {{> loginButtons }}
            </ul>
        </div>
    </div>
    <div class="container">
		{{> adminTemplate}}
	</div>
</body>

<template name="adminTemplate">
	{{#if isAdminUser}}
		{{> accountsAdmin}}
	{{else}}
		Must be admin to see this...
	{{/if}}
</template>

After you edit app.js and app.html you need to create a new user and then set the 'admin' role to that user.

  1. Go to http://localhost:3000 and click on the "Sign In / Up" and create your user there.
  2. In the browser console grab the user id from the user you just created Meteor.userId()
  3. Copy the user id and paste it into to "your_admin_user_id" in app.js created above.
  4. Restart meteor

At this point you should see the UI. Signout and add a few more users so you can play with the roles. You can add and remove roles all through the UI.

Iron Router Integration

This tool plays nice with Iron Router package, add to following configuration to your router. Or take a look at this working example.

router.js

Router.configure({
	layoutTemplate: 'layout'
});

Router.map(function() {
	this.route('home', {
		path: '/',
		template: 'home'
	});

	this.route('admin', {
		path:'/admin',
		template: 'accountsAdmin',
		onBeforeAction: function() {
			if (Meteor.loggingIn()) {
                this.render(this.loadingTemplate);
            } else if(!Roles.userIsInRole(Meteor.user(), ['admin'])) {
                console.log('redirecting');
                this.redirect('/');
            }
		}
	});
});

Contributing

If you've got a change you think would benefit the community send me a pull request.

Contributors

meteor-accounts-admin-ui-bootstrap-3's People

Contributors

alanning avatar djkmiles avatar hharnisc avatar johnm avatar waiski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

meteor-accounts-admin-ui-bootstrap-3's Issues

active?

I was wondering if this project has been abandoned or is still active? I notice a lot of pending commits and can't tell if the package has been updated to support meteor 1.0. Just curious before I go to use it in my project.

Can't toggle dropdown from js

I did not open it with this code:

Template.home.events
  "click .login": (e) ->
    e.preventDefault()
    console.log($("a.dropdown-toggle").length)
    #$("#login-dropdown-list").toggleClass("open",true);
    $("a.dropdown-toggle").dropdown("toggle")

My packeges list:

accounts-password                  1.0.4  Password support for accounts
alanning:roles                     1.2.13  Role-based authorization
aslagle:reactive-table             0.5.2  A reactive table designed for Meteor
bengott:avatar                     0.5.1  Consolidated user avatar template (twitter, facebook, gravatar, etc.)
coffeescript                       1.0.4  Javascript dialect with fewer braces and semicolons
email                              1.0.4  Send email messages
iron:router                        1.0.0  Routing specifically designed for Meteor
jquery                             1.0.1  Manipulate the DOM using CSS selectors
meteor-platform                    1.2.0  Include a standard set of Meteor packages in your app
mizzao:bootstrap-3                 3.3.0  HTML, CSS, and JS framework for developing responsive, mobile first projects on the web.
mrt:accounts-admin-ui-bootstrap-3  0.2.7  A roles based account management system using bootstrap 3
mrt:accounts-ui-bootstrap-3        0.3.3  Bootstrap styled version of login widgets
quietcreep:formation               1.0.2  Slender form creation w/ client & server side validation
sacha:spin                         2.0.4  Simple spinner package for Meteor
tmeasday:errors                    2.0.0  A pattern to display application errors to the user
underscore                         1.0.1  Collection of small helpers: _.map, _.each, ...

I get '1' in the log, manually it works.
I do not understand something?

alanning:roles dependency

i tried to install this, but alanning:roles seems to not work on 0.9.x and it appears development has moved on to the fork digilord:roles

should the dependency be changed or removed like with bootstrap?

many thanks,

paul.

Including bootstrap-modal separately breaks modals

Had an issue where I was generating a modal on the page and it came up as below

Discovered that it was the fact that the bootstrap modal css gets included twice - once in the bootstrap-3/bootstrap.css and once with the bootstrap-modal that is required in the package.json.

Fixed in the meantime by removing
api.use('bootstrap-modal', 'client');
from the package.json. Don't know if this is something to look into or not.

Remove explicit bootstrap-3 dependency

Would you be willing to remove the explicit dependency on the bootstrap-3 package?

The problem is that we're using the less-bootstrap-3 package and having both packages in the project causes problems (bloat, confusing source maps, etc.).

This should be quite safe since anybody using your package is obviously already using bootstrap-3 one way or another. Removing the explicit dependency would allow for easier use by people using Less or incorporating the Bootstrap code directly.

Thanks,
John

Sort of working, what am I missing?

It seems like I have this working, though I only see my admin account in the main listing and I cannot edit it. Search returns nothing. Is this because my user "clark" has no role? How would I make a default role for new users?

Mange roles adds/removes from my roles collection OK:

screen shot 2014-03-12 at 10 42 11 am

meteor:PRIMARY> db.roles.find().pretty();
{ "name" : "admin", "_id" : "hyCiF7pWoYoLhbZ2b" }
{ "name" : "secret", "_id" : "ouYr9qmydkvpWi42C" }
{ "name" : "foo", "_id" : "mxEQCgAG3yYZs6fBX" }

Only see my admin account in main listing when I'd like to assign user to a role:

screen shot 2014-03-12 at 10 41 59 am

meteor:PRIMARY> db.users.find({},{"username":1,"roles":1}).pretty();
{
    "_id" : "Rzv28MrXpjvzaRTy7",
    "roles" : [
        "admin"
    ],
    "username" : "admin"
}
{ "_id" : "guaiG7fjp5SNadxco", "username" : "clark" }

Error: Role already exists. [403]

When I add my user id to app.js, I keep getting an error:

W20140203-15:36:32.985(-5)? (STDERR) /Users/jayfallon/.meteor/tools/09b63f1ed5/lib/node_modules/fibers/future.js:206 W20140203-15:36:32.985(-5)? (STDERR) throw(ex); W20140203-15:36:32.986(-5)? (STDERR) ^ W20140203-15:36:32.992(-5)? (STDERR) Error: Role already exists. [403]

Meteor version: 0.7.0.1

Thanks for any help!

Exception from sub filteredUsers

When I install this package I get this error in the server console:

I20150604-14:23:57.191(2)? Exception from sub filteredUsers id ckXfEK2kAkhxtAZnc Error: Did not check() all arguments during publisher 'filteredUsers'
I20150604-14:23:57.191(2)?     at [object Object]._.extend.throwUnlessAllArgumentsHaveBeenChecked (/Users/leo/src/zirra-web/.meteor/local/build/programs/server/packages/check.js:375:13)
I20150604-14:23:57.191(2)?     at Object.Match._failIfArgumentsAreNotAllChecked (/Users/leo/src/zirra-web/.meteor/local/build/programs/server/packages/check.js:130:16)
I20150604-14:23:57.191(2)?     at maybeAuditArgumentChecks (/Users/leo/src/zirra-web/.meteor/local/build/programs/server/packages/ddp.js:2442:18)
I20150604-14:23:57.191(2)?     at [object Object]._.extend._runHandler (/Users/leo/src/zirra-web/.meteor/local/build/programs/server/packages/ddp.js:1778:17)
I20150604-14:23:57.191(2)?     at [object Object].MeteorX.Subscription._runHandler (/Users/leo/src/zirra-web/.meteor/local/build/programs/server/packages/meteorhacks_unblock.js:61:22)
I20150604-14:23:57.192(2)?     at [object Object].MeteorX.Session._startSubscription (/Users/leo/src/zirra-web/.meteor/local/build/programs/server/packages/meteorhacks_unblock.js:49:7)
I20150604-14:23:57.192(2)?     at [object Object]._.extend.protocol_handlers.sub (/Users/leo/src/zirra-web/.meteor/local/build/programs/server/packages/ddp.js:1410:12)
I20150604-14:23:57.192(2)?     at [object Object].MeteorX.Session.protocol_handlers.sub (/Users/leo/src/zirra-web/.meteor/local/build/programs/server/packages/meteorhacks_unblock.js:23:15)
I20150604-14:23:57.192(2)?     at /Users/leo/src/zirra-web/.meteor/local/build/programs/server/packages/ddp.js:1374:43

accountsAdmin displaying max of 25 users

I'm using accountsAdmin template and having problems with getting it to display all my users. It appears that it will only display 25 users. Is there a way to get it to display my full userlist?

Meteor 0.8.0-rc0 - error

Got this error while testing Meteor 0.8.0-rc0, I'd fix it if I understood what it is about.

While building packageaccounts-admin-ui-bootstrap-3: client/accounts_admin.html:21: Reactive HTML attributes must either have a constant name or consist of a single {{helper}} providing a dictionary of names and values. A template tag of type BLOCKOPEN is not allowed here. ...{#each users}} <tr {{#if myself _id}} c... ^

Routing to /admin fails on first attempt

I'm currently working on an app, using roles + iron-router. I've added the appropriate router code as outlined at https://atmospherejs.com/package/accounts-admin-ui-bootstrap-3#iron-router-integration.

I have created an account with admin role and am logged in with that account. When I manually navigate from any page in my app to /admin, the routing initially fails on the Roles.userIsInRole check, redirecting me to /.

If I then navigate back in my browser history, the admin page renders successfully.

Using:
meteor: 0.8.0
accounts-admin-ui-bootstrap-3: 0.2.5
roles: 1.2.8
iron-router: 0.7.0

Adding custom columns to the users table

I'd like an option for adding custom columns to the users table, like there is in the non-bootstrap3 -version. Is there any special reason why this feature does not exist?

If there are no objections on adding this feature, I could try to implement it myself (although I'm a newbie, but this task doesn't seem very complicated)

Redirect after login not work

I try to run the demo app, login with the admin user/role is fine but the redirect function not work

console.log('redirecting');
this.redirect('/admin');

it also not print anything to the console

Migrating to meteor(ite) v0.9.0

Running mrt migrate-app produces the following error:

Updating all references to packages in .meteor/packages
Error: The version 0.3.5 of package accounts-ui-bootstrap-3 has not yet been migrated

If you want to continue, remove the offending package from smart.json, run 'mrt install', and try again.

After you have successfully migrated, you can add it back but note:
  You will NOT receive further updates to this package.

See https://hackpad.com/Migrating-Apps-UfPrM192vSQ for more information.

Edit roles/name of own account

Currently the admin user logged in is not able to use the UI to manage his/her own account. Is there a reason for that?

profile.name missing in Meteor 1.0. Need to use username instead.

Installed and tested on my Meteor 1.0 app. Noticed Name column always shows the email. Looking at the data and the code I see you are using profile.name, where all my users created from the current standard "accounts-password" have a username attribute instead, and not in profiles.

Need to look there also to be compatible.

PR for impersonation and security checks?

Hi,

I've implemented the basic security checks on input sanitization so that it will run in meteor projects that use their audit-argument-checks package for extra security.

Also I added an impersonation feature where the admin can impersonate (meaning log in as a user, but without having their password) and user. It's really handy for me to help debug my users' data without having to ask for their password or implement some kind of hacky magic login as anyone password.

I haven't submitted a PR directly though because I'm a bit unsure the best way to have developers configure what they want to do on successful impersonation, for me I goto a specific Iron Router route (which I'm guessing is the standard case?). It seems like a broader question on how configuration should work in this package. I'd be happy to talk about it.

Anyway, it's here: https://github.com/andylash/meteor-accounts-admin-ui-bootstrap-3

-=-
andy

packages crashes between bootstrap-3 and accounts-ui-bootstrap-3

I got a problem with using accounts-ui-bootstrap-3 package
When I use it, the login buttons looks weird like bellow,
and when I create account and pressed change password button,
the input form is disappeared so can't change the password.

It seems that there's some crashes between bootstrap-3 and acocunts packages,
but I can't figure it out.

Somebody has a good idea?
Thanks in advance-

based version

Meteorite version 0.7.2
Release 0.8.0.1

screen shot

screenshot 2014-04-21 17 01 34

using packages

standard-app-packages
iron-router
iron-router-progress
font-awesome
coffeescript
accounts-password
bootstrap-3
accounts-ui-bootstrap-3

test code

<template name="header">
    <div class="navbar navbar-fixed-top navbar-inverse" role="navigation">
        <div class="container">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="#">My Bootstrap 3 App</a>
            </div>
            <div class="collapse navbar-collapse">
                <ul class="nav navbar-nav">
                    <li class="active"><a href="#">Home</a></li>
                    <li>{{> loginButtons }}</li>
                </ul>
            </div><!-- /.nav-collapse -->
        </div><!-- /.container -->
    </div>
</template>

ps. I've tested this demo also, but the result was same.
https://github.com/hharnisc/meteor-accounts-admin-ui-bootstrap-3-demo

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.