LimeSurvey issue tracker
Registration

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
08134Feature requests[All Projects] Authenticationpublic2013-09-05 15:392013-09-05 15:39
Reporteratlet 
Assigned To 
PrioritynormalSeverity@50@ 
StatusnewResolutionopen 
Product Version 
Target VersionFixed in Version 
Summary08134: Api for user creation / rights
DescriptionFor Authentication plugin would be nice to have functions:
- for user creation
- for assigning permission to newly created user
Will be nice, to have user an permissions in one call.
Additional InformationHere is the code I use now.

if (is_null($oUser)) {
            // Create new user
            $oUser = new User;
            $oUser->users_name = $sUser;
            $oUser->password = hash('sha256', createPassword());
            $oUser->full_name = $this->atributi['displayName'][0];
            $oUser->parent_id = 1;
            $oUser->lang = 'sl';
            $oUser->email = $this->atributi['mail'][0];
            if ($oUser->save()) {

                $data = array(
                    'entity_id' => 0,
                    'entity' => 'global',
                    'uid' => $oUser->uid,
                    'permission' => 'surveys',
                    'create_p' => 1,
                    'read_p' => 1,
                    'update_p' => 1,
                    'delete_p' => 1,
                    'import_p' => 1,
                    'export_p' => 1
                );

                $permission = new Permission;
                foreach ($data as $k => $v)
                    $permission->$k = $v;
                $permission->save();

                $this->setAuthSuccess($oUser);
                return;
            } else {
                $this->setAuthFailure(self::ERROR_USERNAME_INVALID);
                return;
            }
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
2013-09-05 15:39 atlet New Issue


Copyright © 2000 - 2014 MantisBT Team
Powered by Mantis Bugtracker