showing 40 feeds to multiple users

I have emoncms from github running on AWS using a micro-EC2 and micro-RDS mySQL sessions.

Our project will eventually have 40 feeds from 40 nanodeRF base stations feeding kwh and temperature data from 40 Solar PV systems.

We want multiple users to be able to view the same feeds.

Is this possible with emoncms?

As administrator, can I set up views that users can get when registering and logging in?

How do I prevent new users from adding their own feeds from other emonbase stations?

Any help is greatly appreciated.

regards

Kumar

TrystanLea's picture

Re: showing 40 feeds to multiple users

Hello Kumar

Although out of the box emoncms isnt setup for this, its not too hard to modify it to at least do most of this. We needed a similar setup for a community energy monitoring project that we did here. In time it would probably be good to have some of these features a little more built in.

Its possible to restrict access to certain aspects of the system by adding an admin access clause, for example lets say we want to restrict access to feed/list:

scroll down to line 56 of emoncms/Modules/feed/feed_controller.php

elseif ($action == "list")

you can restrict access to list by adding 

elseif ($action == "list" && $session['admin']==1)

You would want to then remove the feeds link from the top menu when the user is not an administrator you could do this by adding the same clause to feed_menu.php

if ($session['admin']==1) $menu_left[] = array('name'=>"Feeds"

Sharing the feeds with select users without them being public and accessible by all could be a bit more tricky. Can you explain a bit more of what you mean by multiple users wanting to view the same feeds just so Im sure im on the same page. 

Trystan

 

kaiyer's picture

Re: showing 40 feeds to multiple users

Trystan:

Thanks for your reply. The code snippet is helpful. 

Here is the architecture

We have feeds on one side

Feed1, Feed2, ......FeedN

These feeds can be set up only by administrator (thanks to your code snippet above).

 

On the other side you have a group of provisioned users to the site.

User 1, User 2, User3, ...UserM, Admin

Admin sets up the feeds and standard set of views for all accounts. Admin also provides logins

- Admin needs to disable registration on home page and be able to set up a user and just email the users password.

- User then goes to website and on login sees the standard views set up by Admin.

How can I accomplish this?

regards

Kumar

TrystanLea's picture

Re: showing 40 feeds to multiple users

Hello Kumar

Its possible to disable registration by setting $allowusersregister = TRUE; to FALSE in settings.php.

There's not really an easy user interface way for an admin to create a user yet but you could do this by changing

if ($action == 'create' && $allowusersregister) (line 79 of user_controller.php)

to 

if ($action == 'create' && $session['admin'])

and changing line 81:

$username = preg_replace('/[^\w\s-.]/','',post("name")); to $username = preg_replace('/[^\w\s-.]/','',get("name"));

and line 84 again from a post('pass') to a get('pass')

and then as a logged in admin you could create a user via a URL:

/emoncms/user/register?name=NAMEOFUSER&pass=PASSWORD

There's not yet the feature to email the user when an account is created by an admin either so without coding that in youd need to do that manually.

Once you have created the account youd need to setup the inputs, feeds and dashboards for the user. You could then also turn off the dashboard editor via the same type of if admin check as detailed above and in the previous reply.

Im working on an improvement to the emoncms user module at the moment so will keep these ideas in mind see if I can make some of these features integrated parts of emoncms.

Trystan

SebastianDietz's picture

Re: showing 40 feeds to multiple users

Hello,

we're using emoncms to monitor a pv-system of a non-provit assosiation (http://einleuchtend.org/projekte/sonnja/) . Now  we're running in the same problem as Kumar (see in the first post) 2 years ago. In order to fulfill the requests of our sponsors we need a reading access to the data via different user accounts ("sharing feeds between emoncms accounts"). As I can see the emoncms core allows just one way: coping the data to each account. I was wondering if there is still no way to share feeds between different Accounts and if there is no development plan to improve the user management?

Best regards

Sebastian

 

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.