Willkommen, Gast
Benutzername: Passwort: Angemeldet bleiben:
  • Seite:
  • 1
  • 2

THEMA: Creating new user trough plugin

Creating new user trough plugin 1 Jahr 2 Monate her #99530

  • atlet
  • atlets Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 17
  • Karma: 0
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ž
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Creating new user trough plugin 1 Jahr 2 Monate her #99566

  • DenisChenu
  • DenisChenus Avatar
  • OFFLINE
  • Moderator Lime
  • Beiträge: 6551
  • Dank erhalten: 869
  • Karma: 257
In 2.05, we move "Permission" to plugin.

lime_permissions : entity: global :)
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Creating new user trough plugin 1 Jahr 2 Monate her #99571

  • atlet
  • atlets Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 17
  • Karma: 0
Aham. I was looking on plugin examples ...

github.com/LimeSurvey/LimeSurvey/blob/2....er/Authwebserver.php
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Creating new user trough plugin 1 Jahr 2 Monate her #99572

  • atlet
  • atlets Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 17
  • Karma: 0
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
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Creating new user trough plugin 1 Jahr 2 Monate her #99581

  • atlet
  • atlets Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 17
  • Karma: 0
DenisChenu schrieb:
In 2.05, we move "Permission" to plugin.

lime_permissions : entity: global :)

Do you have some example?
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Creating new user trough plugin 1 Jahr 2 Monate her #99589

  • DenisChenu
  • DenisChenus Avatar
  • OFFLINE
  • Moderator Lime
  • Beiträge: 6551
  • Dank erhalten: 869
  • Karma: 257
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Creating new user trough plugin 1 Jahr 2 Monate her #99633

  • atlet
  • atlets Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 17
  • Karma: 0
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... :(
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Creating new user trough plugin 1 Jahr 2 Monate her #99639

  • DenisChenu
  • DenisChenus Avatar
  • OFFLINE
  • Moderator Lime
  • Beiträge: 6551
  • Dank erhalten: 869
  • Karma: 257
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
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Creating new user trough plugin 1 Jahr 2 Monate her #99640

  • atlet
  • atlets Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 17
  • Karma: 0
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...
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Creating new user trough plugin 1 Jahr 2 Monate her #99645

  • mdekker
  • mdekkers Avatar
  • OFFLINE
  • LimeSurvey Team
  • Beiträge: 341
  • Dank erhalten: 68
  • Karma: 38
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
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Folgende Benutzer bedankten sich: atlet
  • Seite:
  • 1
  • 2
Moderatoren: ITEd
Ladezeit der Seite: 0.297 Sekunden
Donation Image