Check out the LimeSurvey source code on GitHub!

Creating new user trough plugin

More
3 years 4 months ago #99530 by atlet
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 4 months ago #99566 by DenisChenu
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).

Please Log in to join the conversation.

More
3 years 4 months ago #99571 by atlet
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 4 months ago #99572 by atlet
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 4 months ago #99581 by atlet

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 4 months ago #99589 by DenisChenu

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).

Please Log in to join the conversation.

More
3 years 4 months ago #99633 by atlet
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 4 months ago #99639 by DenisChenu
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).

Please Log in to join the conversation.

More
3 years 4 months ago #99640 by atlet
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 4 months ago #99645 by mdekker
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 4 months ago #99648 by atlet
Tnx, I filled bug report.

Here it is: bugs.limesurvey.org/view.php?id=8134

Please Log in to join the conversation.

More
3 years 4 months ago #99739 by atlet
How can I assign it to you?

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form