View Issue Details

This bug affects 1 person(s).
 4
IDProjectCategoryView StatusLast Update
08134Feature requestsAuthenticationpublic2019-05-23 10:48
Reporteratlet Assigned To 
PrioritynormalSeverityfeature 
Status newResolutionopen 
Target Version4.0.0dev 
Summary08134: Api for user creation / rights
Description

For 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 Information

Here 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.
Bug heat4
Story point estimate
Users affected %

Users monitoring this issue

atlet

Activities

ollehar

ollehar

2019-05-23 10:48

administrator   ~52064

Bump. Also: New API event to make it easy to create new API functions via a plugin.

Issue History

Date Modified Username Field Change
2013-09-05 15:39 atlet New Issue
2013-09-05 15:39 atlet Issue Monitored: atlet
2019-05-23 10:48 ollehar Note Added: 52064
2019-05-23 10:48 ollehar Severity @50@ => feature
2019-05-23 10:48 ollehar Target Version => 4.0.0dev