Set the current profile

@return void
429224
protected function _setProfile() {
        $projectName = basename(dirname(realpath(APPLICATION_PATH)));
        $profileName = $projectName . '_' . APPLICATION_ENV;

        $this->_profile = $profileName;
    }
1146676
def setProfiles(self, profiles):
        
        self.blockSignals(True)
        self._profileCombo.blockSignals(True)
        
        self._profiles = profiles[:]
        self._profileCombo.clear()
        self._profileCombo.addItems(map(lambda x: x.name(), profiles))
        
        self._profileCombo.blockSignals(False)
        self.blockSignals(False)
411923
public function getCurrent()
    {
        if (!$this->currentProfile) {
            // first check to see if we have a Profile in the session
            if ($profile_id = $this->session->get('profile_id')) {
                // we do, so try and grap it from the db
                $this->currentProfile = $this->doctrine->getManager()
                    ->getRepository('HarvestCloudCoreBundle:Profile')
                    ->find($profile_id)
                ;
            }

            $user = $this->context->getToken()->getUser();

            // try to get the current User's default Profile
            if (!$this->currentProfile) {
                $this->currentProfile = $user->getDefaultProfile();
            }

            // try to get the User's first Profile
            if (!$this->currentProfile) {
                foreach ($user->getProfiles() as $profile) {
                    $this->currentProfile = $profile;

                    break;
                }
            }

            if (!$this->currentProfile) {
                $this->session->remove('profile_id');

                throw new \Exception('Cannot find current Profile');
            }

            $this->session->set('profile_id', $this->currentProfile->getId());
        }

        return $this->currentProfile;
    }
216372
public function me()
    {
        $this->loadModel('User.Users');
        $user = $this->Users->get(user()->id, ['conditions' => ['status' => 1]]);
        $languages = LocaleToolbox::languagesList();

        if ($this->request->data()) {
            $user->accessible(['id', 'username', 'roles', 'status'], false);
            $user = $this->Users->patchEntity($user, $this->request->data);
            if ($this->Users->save($user)) {
                $this->Flash->success(__d('user', 'User information successfully updated!'), ['key' => 'user_profile']);
                $this->redirect($this->referer());
            } else {
                $this->Flash->danger(__d('user', 'User information could not be saved, please check your information.'), ['key' => 'user_profile']);
            }
        }

        $this->title(__d('user', 'Account'));
        $this->set(compact('user', 'languages'));
        $this->viewMode('full');
    }
23731
public function indexAction()
    {
        $this->view->setTemplateBefore('private');

        if ($this->request->isPost()) {

            // Validate the profile
            $profile = Profiles::findFirstById($this->request->getPost('profileId'));

            if ($profile) {

                if ($this->request->hasPost('permissions')) {

                    // Deletes the current permissions
                    $profile->getPermissions()->delete();

                    // Save the new permissions
                    foreach ($this->request->getPost('permissions') as $permission) {

                        $parts = explode('.', $permission);

                        $permission = new Permissions();
                        $permission->profilesId = $profile->id;
                        $permission->resource = $parts[0];
                        $permission->action = $parts[1];

                        $permission->save();
                    }

                    $this->flash->success('Permissions were updated with success');
                }

                // Rebuild the ACL with
                $this->acl->rebuild();

                // Pass the current permissions to the view
                $this->view->permissions = $this->acl->getPermissions($profile);
            }

            $this->view->profile = $profile;
        }

        // Pass all the active profiles
        $this->view->profiles = Profiles::find([
            'active = :active:',
            'bind' => [
                'active' => 'Y'
            ]
        ]);
    }
1147192
protected function setProfile($profile)
	{
		if ( ! is_string($profile) && $profile !== null)
		{
			throw new \InvalidArgumentException('Wrong profile value.');
		}
		
		$this->profile = $profile;
		
		return $this;
	}
536404
public function profileStart($name)
    {
        if (!is_string($name) || empty($name)) {
            return;
        }

        $this->_profileStacks[$name] = microtime(true);
    }
609715
public function setCurrent(): void
	{
		$this->current = true;
		$parent = $this->parent;
		if ($parent instanceof Item) {
			$parent->setCurrent();
		}
	}
596547
public function setProfile($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Talent\V4beta1\Profile::class);
        $this->profile = $var;

        return $this;
    }
886600
public function profile()
    {
        if ($this->config()->get('disable_profiles')) {
            $this->httpError(404, 'Not Found');
        }

        $profile = $this->getCurrentProfile();

        if (!$profile) {
            return $this->httpError(404, 'Not Found');
        }

        $this->blogPosts = $this->getCurrentProfilePosts();

        return $this->render();
    }
1001019
def saveProfile( self ):
        
        manager = self.parent()
        prof    = manager.currentProfile()
        
        # save the current profile
        save_prof = manager.viewWidget().saveProfile()
        prof.setXmlElement(save_prof.xmlElement())
543596
public function setProfilerStatus($enabled = true) {
		$this->_profilerEnabled = (bool) $enabled;
		
		if ($this->_profilerEnabled && ! $this->_profilerResolved) {
			$eventsManager = $this->getEventsManager();
			
			if ($eventsManager === null) {
				$eventsManager = new Manager();
				
				$this->setEventsManager($eventsManager);
			}
			
			$eventsManager->attach('db:beforeQuery', function($event, $db) {
				if ($this->_profilerEnabled) {
					$query    = $db->getSQLStatement();
					$profiler = $this->getProfiler();
					
					$action = substr($query, 0, strpos($query, ' '));
					
					if ($action === 'SELECT') {
						$profiler->startRead($query);
					}
					else if ($action === 'UPDATE') {
						$profiler->startWrite($query);
					}
					else if ($action === 'INSERT') {
						$profiler->startInsert($query);
					}
					else if ($action === 'DELETE') {
						$profiler->startDelete($query);
					}
					else {
						$profiler->startInfo($query);
					}
				}
			});
			
			$eventsManager->attach('db:afterQuery', function($event, $db) {
				if ($this->_profilerEnabled) {
					$this->getProfiler()->stopEvent();
				}
			});
			
			$this->_profilerResolved = true;
		}
	}
369547
public function assignProfiles($profiles) : void
    {
        $profiles = (array) $profiles;
        foreach ($profiles as $profile) {
            $electedProfile = Profile::where('code', $profile)->first();

            // Profile exists and not assigned to user?
            if (!is_null($electedProfile) && !$this->hasProfile($profile)) {
                // Assign both role and permissions defined for this user profile.
                // Into the Spatie Permissions.
                $this->assignRole(Role::find([$electedProfile->role_id])->first()->name);
                $this->givePermissionTo(Permission::find([$electedProfile->permission_id])->first()->name);

                // Assign user profile into the profiles table.
                $this->profiles()->save($electedProfile);
            }
        }
    }
69904
public function updateProfile()
    {
        if ($this->v["uID"] > 0) {
            // $GLOBALS["SL"]->user() returns an instance of the authenticated user...
            if ($this->v["uID"] == $GLOBALS["SL"]->REQ->uID || $this->v["user"]->hasRole('administrator')) {
                $user = User::find($GLOBALS["SL"]->REQ->uID);
                $user->name = $GLOBALS["SL"]->REQ->name;
                $user->email = $GLOBALS["SL"]->REQ->email;
                $user->save();
                $user->loadRoles();
                if ($this->v["user"]->hasRole('administrator')) {
                    if ($GLOBALS["SL"]->REQ->has('roles') && is_array($GLOBALS["SL"]->REQ->roles)
                        && sizeof($GLOBALS["SL"]->REQ->roles) > 0) {
                        foreach ($user->roles as $i => $role) {
                            if (in_array($role->DefID, $GLOBALS["SL"]->REQ->roles)) {
                                if (!$user->hasRole($role->DefSubset)) {
                                    $user->assignRole($role->DefSubset);
                                }
                            } elseif ($user->hasRole($role->DefSubset)) {
                                $user->revokeRole($role->DefSubset);
                            }
                        }
                    } else { // no roles selected, delete all that exist
                        foreach ($user->roles as $i => $role) {
                            if ($user->hasRole($role->DefSubset)) {
                                $user->revokeRole($role->DefSubset);
                            }
                        }
                    }
                }
                $this->redir('/profile/' . urlencode($user->name), true);
                return true;
            }
        }
        return false;
    }
596722
public void setProfile(OperaProfile profile) {
    options.get(PROFILE).setValue(PROFILE.sanitize(profile));
    supportsPd = true;
  }
723336
public void onProfileClick() {
        //crossfade if we are cross faded
        if (mCrossFader != null) {
            if (mCrossFader.isCrossfaded()) {
                mCrossFader.crossfade();
            }
        }

        //update the current profile
        if (mAccountHeader != null) {
            IProfile profile = mAccountHeader.getActiveProfile();
            if (profile instanceof IDrawerItem) {
                mItemAdapter.set(0, generateMiniDrawerItem((IDrawerItem) profile));
            }
        }
    }
610138
def handle_profile_form(form):
    """"""
    form.process(formdata=request.form)

    if form.validate_on_submit():
        email_changed = False
        with db.session.begin_nested():
            # Update profile.
            current_userprofile.username = form.username.data
            current_userprofile.full_name = form.full_name.data
            db.session.add(current_userprofile)

            # Update email
            if current_app.config['USERPROFILES_EMAIL_ENABLED'] and \
               form.email.data != current_user.email:
                current_user.email = form.email.data
                current_user.confirmed_at = None
                db.session.add(current_user)
                email_changed = True
        db.session.commit()

        if email_changed:
            send_confirmation_instructions(current_user)
            # NOTE: Flash message after successful update of profile.
            flash(_('Profile was updated. We have sent a verification '
                    'email to %(email)s. Please check it.',
                    email=current_user.email),
                  category='success')
        else:
            # NOTE: Flash message after successful update of profile.
            flash(_('Profile was updated.'), category='success')