Creating new user trough plugin

More
3 years 11 months ago #99530 by atlet
atlet created the topic: Creating new user trough plugin
Hi,

for login I created a plugin that checks if new user exist. If doesn't exist, it creates with this code
$oUser=new User;
$oUser->users_name=$sUser;
$oUser->password=hash('sha256', createPassword());
$oUser->full_name=$aUserProfile['full_name'];
$oUser->parent_id=1;
$oUser->lang='sl';
$oUser->email=$aUserProfile['email'];
$oUser->create_survey=TRUE;
 
if ($oUser->save())

But when it tries creating a new user, I get that error:

Property "User.create_survey" is not defined.


If I remove this line:
$oUser->create_survey=TRUE;

It's working fine. Is name of property create_survey different?

Regards Andraž

Please Log in to join the conversation.

More
3 years 11 months ago #99566 by DenisChenu
DenisChenu replied the topic: Creating new user trough plugin
In 2.05, we move "Permission" to plugin.

lime_permissions : entity: global :)

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

More
3 years 11 months ago #99571 by atlet
atlet replied the topic: Creating new user trough plugin
Aham. I was looking on plugin examples ...

github.com/LimeSurvey/LimeSurvey/blob/2....er/Authwebserver.php

Please Log in to join the conversation.

More
3 years 11 months ago #99572 by atlet
atlet replied the topic: Creating new user trough plugin
Now I create with this code
$aPermissions['create_survey'] = $this->get('permission_create_survey', null, null, false);
                Permission::model()->setPermissions($oUser->uid, 0, 'global', $aPermissions);

But I get this error:

You are not allowed to set permisisons for this user

Please Log in to join the conversation.

More
3 years 11 months ago #99581 by atlet
atlet replied the topic: Creating new user trough plugin

DenisChenu wrote: In 2.05, we move "Permission" to plugin.

lime_permissions : entity: global :)


Do you have some example?

Please Log in to join the conversation.

More
3 years 11 months ago #99589 by DenisChenu
DenisChenu replied the topic: Creating new user trough plugin

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

More
3 years 11 months ago #99633 by atlet
atlet replied the topic: Creating new user trough plugin
The problem is, that I'm creating user trough login plugin - but I'm not logged in, so I don't have enough permissions to set user permissions... :(

Please Log in to join the conversation.

More
3 years 11 months ago #99639 by DenisChenu
DenisChenu replied the topic: Creating new user trough plugin
I don't understand : Loggued permission is used only in web access or with RemoteControl. If you make yourself a plugin : then you can "naot" control rights of user

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

More
3 years 11 months ago #99640 by atlet
atlet replied the topic: Creating new user trough plugin
So, the thing is, I created Authentication plugin with SimpleSAMLphp. If user doesn't exist in Limesurvey, I create it and assign permissions. It's working fine, but I would like using native methods when creating users. Now I'm writing directly to db, and this is not good solution...

Please Log in to join the conversation.

More
3 years 11 months ago #99645 by mdekker
mdekker replied the topic: Creating new user trough plugin
You just found the issues we still need to address. We intent to offer methods in the api for user creation / rights but had no use case for it. If you could file a bug report for the api methods you would like to see and assign it to me, I am more than happy to implement that. I want to have a look at your plugin too to see if the LS needs to be changed to make it more flexible. Open to discussion, please open a bug report so we can discuss there.

Thank you for the work done and interest in the project!

---
Menno Dekker
The following user(s) said Thank You: atlet

Please Log in to join the conversation.

More
3 years 11 months ago #99648 by atlet
atlet replied the topic: Creating new user trough plugin

Please Log in to join the conversation.

More
3 years 11 months ago #99739 by atlet
atlet replied the topic: Creating new user trough plugin
How can I assign it to you?

Please Log in to join the conversation.

Did you already participate in our customer survey?

Don't miss your chance for great prices.

Please click here to participate:

Start now

Start now!

Just create your account and start using Limesurvey today.

Register now