Community discussions

MUM Europe 2020
 
beepee
Member Candidate
Member Candidate
Topic Author
Posts: 139
Joined: Tue Sep 18, 2007 6:13 am

Add profile to user via Console/API/Script

Tue May 17, 2011 11:18 am

Please I need to change/add profile to users in userman (over 5000users)
I know it is best to do this using scripting or API but I dont see any console menu to perform this.
Any way forward
OR
Should I downgrade to v4.17?
 
siprox
Frequent Visitor
Frequent Visitor
Posts: 83
Joined: Fri Apr 01, 2011 11:14 am

Re: Add profile to user via Console/API/Script

Tue May 17, 2011 12:31 pm

now you're in trouble, calm down, we are have the same problems :D
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 24333
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: Add profile to user via Console/API/Script

Tue May 17, 2011 12:37 pm

are you using v5.2?
*) user manager - added /tool usermanager profile;
No answer to your question? How to write posts
 
beepee
Member Candidate
Member Candidate
Topic Author
Posts: 139
Joined: Tue Sep 18, 2007 6:13 am

Re: Add profile to user via Console/API/Script

Tue May 17, 2011 1:23 pm

are you using v5.2?
*) user manager - added /tool usermanager profile;
Yes profile menu is available, but how do U assign any of the profile to users in console?
i.e
in menu /tool usermanager user, there should be a menu or option to select a profile for the specified user.
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 24333
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: Add profile to user via Console/API/Script

Tue May 17, 2011 1:39 pm

yes, we will add that feature later
No answer to your question? How to write posts
 
beepee
Member Candidate
Member Candidate
Topic Author
Posts: 139
Joined: Tue Sep 18, 2007 6:13 am

Re: Add profile to user via Console/API/Script

Tue May 17, 2011 3:03 pm

yes, we will add that feature later
But for now, I guess we can downgrade to v4x where such is available
Right.
 
siprox
Frequent Visitor
Frequent Visitor
Posts: 83
Joined: Fri Apr 01, 2011 11:14 am

Re: Add profile to user via Console/API/Script

Wed May 18, 2011 12:59 am

yes, we will add that feature later
But for now, I guess we can downgrade to v4x where such is available
Right.
i think version 5.2 still can't use for real production, at least till mature. They heavy developing nv2, etc but maybe forgot usermanager.
 
fabiosara
just joined
Posts: 2
Joined: Tue May 31, 2011 3:30 pm

Re: Add profile to user via Console/API/Script

Tue May 31, 2011 3:45 pm

yes, we will add that feature later
But for now, I guess we can downgrade to v4x where such is available
Right.
Hello all,
I have the same problem.
Are there any news?
Is there a way to assign profiles to user via web?
Eg http://www.yourradius.com/userman/mwt/x ... =myprofile

Or is there a way to query directly to usermanager database?

Thanks a lot

Fabio
 
fabiosara
just joined
Posts: 2
Joined: Tue May 31, 2011 3:30 pm

Re: Add profile to user via Console/API/Script

Mon Jun 06, 2011 6:39 pm

I found a workaround to assign a profile to a user:

I created a profile like this (2 hours per day)
/tool user-manager profile
add name=2hperday name-for-users=2hperday override-shared-users=unlimited price=0 starts-at=logon validity=0s
/tool user-manager profile limitation
add address-list="" download-limit=0B group-name="" ip-pool="" name=Limit2h transfer-limit=0B upload-limit=0B uptime-limit=2h
/tool user-manager profile profile-limitation
add from-time=0s limitation=Limit2h profile=2hperday till-time=23h59m59s weekdays=sunday,monday,tuesday,friday,saturday

Then I created a user "master"
add customer=admin disabled=no name=user2h password="aseGD73??!jksghrf" shared-users=unlimited wireless-enc-algo=none wireless-enc-key="" wireless-psk=""
and via webmanager, I assigned the profile I want (in this case, "2hperday")


Now, I create the user via script / shell / api using this command
add customer=admin username=USERTEST password=PASSWORDTEST location=test phone=01123456798 email=test@test.com first-name=USER last-name=TEST name=test copy-from=user2h
The key is the copy-from= parameter

So, we can create a "master user" for each profile, and create many users as we want using "copy-from" and give the "master user".

I hope this could be useful until developers fix this bug.


I know it is not optimal solution, because the "total time left" is not diplayed in user manager, but the user statics are correct.
 
vdelarenal75
Frequent Visitor
Frequent Visitor
Posts: 70
Joined: Fri May 22, 2009 1:28 am

Re: Add profile to user via Console/API/Script

Tue Jun 07, 2011 7:12 pm

It works!!!! Thank you for sharing this, it really helped.
I found a workaround to assign a profile to a user:

I created a profile like this (2 hours per day)
/tool user-manager profile
add name=2hperday name-for-users=2hperday override-shared-users=unlimited price=0 starts-at=logon validity=0s
/tool user-manager profile limitation
add address-list="" download-limit=0B group-name="" ip-pool="" name=Limit2h transfer-limit=0B upload-limit=0B uptime-limit=2h
/tool user-manager profile profile-limitation
add from-time=0s limitation=Limit2h profile=2hperday till-time=23h59m59s weekdays=sunday,monday,tuesday,friday,saturday

Then I created a user "master"
add customer=admin disabled=no name=user2h password="aseGD73??!jksghrf" shared-users=unlimited wireless-enc-algo=none wireless-enc-key="" wireless-psk=""
and via webmanager, I assigned the profile I want (in this case, "2hperday")


Now, I create the user via script / shell / api using this command
add customer=admin username=USERTEST password=PASSWORDTEST location=test phone=01123456798 email=test@test.com first-name=USER last-name=TEST name=test copy-from=user2h
The key is the copy-from= parameter

So, we can create a "master user" for each profile, and create many users as we want using "copy-from" and give the "master user".

I hope this could be useful until developers fix this bug.


I know it is not optimal solution, because the "total time left" is not diplayed in user manager, but the user statics are correct.
 
pljubas
newbie
Posts: 40
Joined: Tue Sep 22, 2009 12:46 pm

Re: Add profile to user via Console/API/Script

Mon Oct 31, 2011 2:44 pm

yes, we will add that feature later
Hi Normis,

I've upgraded my userman router from 4.17 to 5.7.
There are 1.400 users with different profiles.

In ROS 5.7 there is still no way to set profile to user from console. Or, I'm I wrong?

It is nearly impossible to set profile to 1.400 users from web...

Any help available?

Best regards,

Petar
 
User avatar
neandero
Member Candidate
Member Candidate
Posts: 243
Joined: Fri Jul 17, 2009 11:43 am
Location: Inside Mind

Re: Add profile to user via Console/API/Script

Mon Oct 31, 2011 11:56 pm

This issue is now becoming very urgent with each user increase on the network.

Please admins, push developers for sooner feature addition and release.. :D
 
User avatar
neandero
Member Candidate
Member Candidate
Posts: 243
Joined: Fri Jul 17, 2009 11:43 am
Location: Inside Mind

Re: Add profile to user via Console/API/Script

Tue Nov 01, 2011 12:10 am

Oh yeah, I forgot something...

while you do add this feature, if POSSIBLE, add another feature where UM can auto switch profile for a user based on download used per day.

example:
user1 basic profile is profile2 2M/2M
if user1 download so much per day say 5G to 10G
UM should auto switch user1 profile from profile2 to profile1 1M/1M
UM should reset user1 profile back to profile2 at Midnight each day.

something like this.. a little way to control who's download so much and who's not - and who should get more speed over the other.
 
User avatar
tgrand
Long time Member
Long time Member
Posts: 671
Joined: Mon Aug 21, 2006 2:57 am
Location: Winnipeg, Manitoba, Canada

Re: Add profile to user via Console/API/Script

Thu Nov 03, 2011 6:15 am

Before they do any changes, they must first clean things up.
The User-Manager still continues to use 2 databases.

Try clearing stats in web, and you will notice the stats in the console continue to accumulate without having been cleared.

Lots and Lots of clean-up to do.
As well User-Manager development would appear to be of LOW priority.
 
Percanta
newbie
Posts: 39
Joined: Tue Feb 24, 2009 1:00 am

Re: Add profile to user via Console/API/Script

Fri Nov 04, 2011 3:18 pm

i was thinking what it uses 2 database too, as the search of sessions in webUM is good but in API-CLI is very poor performance
 
jdevora
just joined
Posts: 8
Joined: Tue Mar 27, 2012 4:18 pm

Re: Add profile to user via Console/API/Script

Tue Mar 27, 2012 6:35 pm

Any news about this issue?

Cheers
JD
 
aysan
newbie
Posts: 34
Joined: Wed Aug 18, 2010 11:40 am

Re: Add profile to user via Console/API/Script

Fri Mar 30, 2012 12:29 am

I was so happy with UM 4.17. But now I cannot work with UM 5.x because of bugs.

I am using UM php & cli, I solve some problems on v.5.x but still more... For example, if I assing an user to 1 hour profile, UM should throw out after 1 hour but user still continuous to use internet.

Another problem is credit-left. I cannot find with cli users credit-left as v.4.17 on v.5.x.

The biggest problem is, I can use 4.17 with no problem but new routerboards doesn't support ROS 4.x. I cannot use ROS 5.x beacuse of new UM so I cannot use new model routerboards. I bought RB1100AH and I have so many RB1200, RB750GL etc. doesn't support ROS 4.x.

I don't understand why new model boards are does not support ROS v4.x and Mikrotik doesn't solve UM v5.x bugs.
 
athome
just joined
Posts: 3
Joined: Tue Jun 28, 2011 7:39 pm

Re: Add profile to user via Console/API/Script

Tue May 21, 2013 9:54 am

Thank you MTIK developers for this:
/tool user-manager user> create-and-activate-profile user="UUUU" customer="CCCC" profile="PPPP"
Last edited by athome on Mon Oct 13, 2014 7:22 pm, edited 1 time in total.
 
ojeysky
Frequent Visitor
Frequent Visitor
Posts: 68
Joined: Tue Mar 10, 2009 2:04 pm

Re: Add profile to user via Console/API/Script

Wed May 22, 2013 5:35 pm

Thank you MTIK developers for this:

/tool user-manager user> create-and-activate-profile user="UUUU" customer="CCCC" profile="PPPP"
This will only be applicable to already existing user. So i guess the problem still exist. Something like below is required:
/tool user-manager user add username=test password=test customer=test name=sample profile=double
 
ojeysky
Frequent Visitor
Frequent Visitor
Posts: 68
Joined: Tue Mar 10, 2009 2:04 pm

Re: Add profile to user via Console/API/Script

Wed May 22, 2013 5:37 pm

Best Workaround so far! Thanks!
I found a workaround to assign a profile to a user:

I created a profile like this (2 hours per day)
/tool user-manager profile
add name=2hperday name-for-users=2hperday override-shared-users=unlimited price=0 starts-at=logon validity=0s
/tool user-manager profile limitation
add address-list="" download-limit=0B group-name="" ip-pool="" name=Limit2h transfer-limit=0B upload-limit=0B uptime-limit=2h
/tool user-manager profile profile-limitation
add from-time=0s limitation=Limit2h profile=2hperday till-time=23h59m59s weekdays=sunday,monday,tuesday,friday,saturday

Then I created a user "master"
add customer=admin disabled=no name=user2h password="aseGD73??!jksghrf" shared-users=unlimited wireless-enc-algo=none wireless-enc-key="" wireless-psk=""
and via webmanager, I assigned the profile I want (in this case, "2hperday")


Now, I create the user via script / shell / api using this command
add customer=admin username=USERTEST password=PASSWORDTEST location=test phone=01123456798 email=test@test.com first-name=USER last-name=TEST name=test copy-from=user2h
The key is the copy-from= parameter
So, we can create a "master user" for each profile, and create many users as we want using "copy-from" and give the "master user".

I hope this could be useful until developers fix this bug.


I know it is not optimal solution, because the "total time left" is not diplayed in user manager, but the user statics are correct.
Last edited by ojeysky on Mon May 05, 2014 9:25 pm, edited 1 time in total.
 
User avatar
mousa1983
Frequent Visitor
Frequent Visitor
Posts: 79
Joined: Mon Apr 21, 2014 2:36 pm
Location: ilam-iran

Re: Add profile to user via Console/API/Script

Mon May 05, 2014 9:17 pm

Version 6.12 and This problem is still not resolved
 
rore
just joined
Posts: 9
Joined: Fri Sep 26, 2014 11:02 pm

Re: Add profile to user via Console/API/Script

Mon Oct 06, 2014 1:12 am

still no solution since Version 4.xx and since 2 years for that?
 
nothing
just joined
Posts: 3
Joined: Thu Aug 13, 2015 11:17 am

Re: Add profile to user via Console/API/Script

Wed Jul 13, 2016 1:28 pm

Few years later you still can't add user-manager profiles from CLI...
Geez...
 
alisss54
just joined
Posts: 1
Joined: Fri Jan 13, 2017 3:17 pm

Re: Add profile to user via Console/API/Script

Fri Jan 13, 2017 3:28 pm

you can do it easily using this code
/tool user-manager user add customer=ali  username=uuuuu password=test  ;/tool user-manager user create-and-activate-profile customer=ali profile=ppppp "uuuuu"
 
User avatar
ADahi
Member Candidate
Member Candidate
Posts: 217
Joined: Thu Sep 21, 2017 7:16 pm
Location: Iraq, Ninavah
Contact:

Re: Add profile to user via Console/API/Script

Fri Dec 08, 2017 3:16 pm

via Script/CLI
suppose username is "111"
suppose profile is TRIAL

To remove user profiles try this
/tool user-manager user clear-profiles numbers=[find username="111"]; 


To add profile to user try this
/tool user-manager user create-and-activate-profile profile=TRIAL customer=admin numbers=[find username="111"]; 


Best Regards
 
Abdulrahman
just joined
Posts: 4
Joined: Mon Mar 26, 2018 8:29 pm

Re: Add profile to user via Console/API/Script

Sun Apr 08, 2018 7:01 pm

Thank you very much. This command works well on the CLI:

/tool user-manager user create-and-activate-profile profile=TRIAL customer=admin numbers=[find username="111"];

But unfortunately, it doesn't work when using the api to send the command, because "find" is not supported through the api.

So please, what is the alternatives that work through the api.

Thanks in advance
 
User avatar
ADahi
Member Candidate
Member Candidate
Posts: 217
Joined: Thu Sep 21, 2017 7:16 pm
Location: Iraq, Ninavah
Contact:

Re: Add profile to user via Console/API/Script

Mon Apr 09, 2018 2:20 pm

you can get sequence number of the user
/tool user-manager user print                                        
Flags: X - disabled, A - active, I - incomplete 
 0     customer=admin username="111" password="" shared-users=1 wireless-psk="" wireless-enc-key="" wireless-enc-algo=none last-seen=never

and use it like:
/tool user-manager user create-and-activate-profile profile=TRIAL customer=admin numbers=0; 
 
Abdulrahman
just joined
Posts: 4
Joined: Mon Mar 26, 2018 8:29 pm

Great! it works, thanks millions

Mon Apr 09, 2018 5:37 pm

Great! it works, thanks millions
you can get sequence number of the user
/tool user-manager user print                                        
Flags: X - disabled, A - active, I - incomplete 
 0     customer=admin username="111" password="" shared-users=1 wireless-psk="" wireless-enc-key="" wireless-enc-algo=none last-seen=never

and use it like:
/tool user-manager user create-and-activate-profile profile=TRIAL customer=admin numbers=0; 
 
User avatar
ADahi
Member Candidate
Member Candidate
Posts: 217
Joined: Thu Sep 21, 2017 7:16 pm
Location: Iraq, Ninavah
Contact:

Re: Great! it works, thanks millions

Mon Apr 09, 2018 11:24 pm

Great! it works, thanks millions
you can get sequence number of the user
/tool user-manager user print                                        
Flags: X - disabled, A - active, I - incomplete 
 0     customer=admin username="111" password="" shared-users=1 wireless-psk="" wireless-enc-key="" wireless-enc-algo=none last-seen=never

and use it like:
/tool user-manager user create-and-activate-profile profile=TRIAL customer=admin numbers=0; 
millions welcome :wink:
 
paramex
just joined
Posts: 3
Joined: Tue Nov 14, 2017 9:36 pm

Re: Add profile to user via Console/API/Script

Thu May 17, 2018 12:29 am

Thank you very much. This command works well on the CLI:

/tool user-manager user create-and-activate-profile profile=TRIAL customer=admin numbers=[find username="111"];

But unfortunately, it doesn't work when using the api to send the command, because "find" is not supported through the api.

So please, what is the alternatives that work through the api.

Thanks in advance
use this char "?"
/tool user-manager user create-and-activate-profile profile=TRIAL customer=admin ?numbers="111"

Who is online

Users browsing this forum: No registered users and 7 guests