Setup administrator
972809
protected function setupAdministrator()
    {
        $question = new ConfirmationQuestion('Would you like to create default administrator user (Recommended)? [y/n] ', true);
        if (!$this->helper->ask($this->input, $this->output, $question)) {
            return;
        }

        $this->runCommand('avoo:user:create');
    }
905741
public function admin_setup() {

		$pods = pods_api()->load_pods( array( 'fields' => false ) );

		$view = pods_v( 'view', 'get', 'all', true );

		// @codingStandardsIgnoreLine
		if ( empty( $pods ) && ! isset( $_GET['action'] ) ) {
			// @codingStandardsIgnoreLine
			$_GET['action'] = 'add';
		}

		// @codingStandardsIgnoreLine
		if ( 'pods-add-new' === $_GET['page'] ) {
			// @codingStandardsIgnoreLine
			if ( isset( $_GET['action'] ) && 'add' !== $_GET['action'] ) {
				pods_redirect(
					pods_query_arg(
						array(
							'page'   => 'pods',
							// @codingStandardsIgnoreLine
							'action' => $_GET['action'],
						)
					)
				);
			} else {
				// @codingStandardsIgnoreLine
				$_GET['action'] = 'add';
			}
			// @codingStandardsIgnoreLine
		} elseif ( isset( $_GET['action'] ) && 'add' === $_GET['action'] ) {
			pods_redirect(
				pods_query_arg(
					array(
						'page'   => 'pods-add-new',
						'action' => '',
					)
				)
			);
		}//end if

		$types = array(
			'post_type' => __( 'Post Type (extended)', 'pods' ),
			'taxonomy'  => __( 'Taxonomy (extended)', 'pods' ),
			'cpt'       => __( 'Custom Post Type', 'pods' ),
			'ct'        => __( 'Custom Taxonomy', 'pods' ),
			'user'      => __( 'User (extended)', 'pods' ),
			'media'     => __( 'Media (extended)', 'pods' ),
			'comment'   => __( 'Comments (extended)', 'pods' ),
			'pod'       => __( 'Advanced Content Type', 'pods' ),
			'settings'  => __( 'Custom Settings Page', 'pods' ),
		);

		$row = false;

		$pod_types_found = array();

		$fields = array(
			'label'       => array( 'label' => __( 'Label', 'pods' ) ),
			'name'        => array( 'label' => __( 'Name', 'pods' ) ),
			'type'        => array( 'label' => __( 'Type', 'pods' ) ),
			'storage'     => array(
				'label' => __( 'Storage Type', 'pods' ),
				'width' => '10%',
			),
			'field_count' => array(
				'label' => __( 'Number of Fields', 'pods' ),
				'width' => '8%',
			),
		);

		$total_fields = 0;

		foreach ( $pods as $k => $pod ) {
			if ( isset( $types[ $pod['type'] ] ) ) {
				if ( in_array(
					$pod['type'], array(
						'post_type',
						'taxonomy',
					), true
				) ) {
					if ( empty( $pod['object'] ) ) {
						if ( 'post_type' === $pod['type'] ) {
							$pod['type'] = 'cpt';
						} else {
							$pod['type'] = 'ct';
						}
					}
				}

				if ( ! isset( $pod_types_found[ $pod['type'] ] ) ) {
					$pod_types_found[ $pod['type'] ] = 1;
				} else {
					$pod_types_found[ $pod['type'] ] ++;
				}

				if ( 'all' !== $view && $view !== $pod['type'] ) {
					unset( $pods[ $k ] );

					continue;
				}

				$pod['real_type'] = $pod['type'];
				$pod['type']      = $types[ $pod['type'] ];
			} elseif ( 'all' !== $view ) {
				continue;
			}//end if

			$pod['storage'] = ucwords( $pod['storage'] );

			// @codingStandardsIgnoreLine
			if ( $pod['id'] == pods_v( 'id' ) && 'delete' !== pods_v( 'action' ) ) {
				$row = $pod;
			}

			$pod = array(
				'id'          => $pod['id'],
				'label'       => pods_v( 'label', $pod ),
				'name'        => pods_v( 'name', $pod ),
				'object'      => pods_v( 'object', $pod ),
				'type'        => pods_v( 'type', $pod ),
				'real_type'   => pods_v( 'real_type', $pod ),
				'storage'     => pods_v( 'storage', $pod ),
				'field_count' => count( $pod['fields'] ),
			);

			$total_fields += $pod['field_count'];

			$pods[ $k ] = $pod;
		}//end foreach

		if ( false === $row && 0 < pods_v( 'id' ) && 'delete' !== pods_v( 'action' ) ) {
			pods_message( 'Pod not found', 'error' );

			// @codingStandardsIgnoreLine
			unset( $_GET['id'], $_GET['action'] );
		}

		$ui = array(
			'data'             => $pods,
			'row'              => $row,
			'total'            => count( $pods ),
			'total_found'      => count( $pods ),
			'items'            => 'Pods',
			'item'             => 'Pod',
			'fields'           => array(
				'manage' => $fields,
			),
			'actions_disabled' => array( 'view', 'export' ),
			'actions_custom'   => array(
				'add'       => array( $this, 'admin_setup_add' ),
				'edit'      => array( $this, 'admin_setup_edit' ),
				'duplicate' => array(
					'callback'          => array( $this, 'admin_setup_duplicate' ),
					'restrict_callback' => array( $this, 'admin_setup_duplicate_restrict' ),
				),
				'reset'     => array(
					'label'             => __( 'Delete All Items', 'pods' ),
					'confirm'           => __( 'Are you sure you want to delete all items from this Pod? If this is an extended Pod, it will remove the original items extended too.', 'pods' ),
					'callback'          => array( $this, 'admin_setup_reset' ),
					'restrict_callback' => array( $this, 'admin_setup_reset_restrict' ),
					'nonce'             => true,
				),
				'delete'    => array( $this, 'admin_setup_delete' ),
			),
			'action_links'     => array(
				'add' => pods_query_arg(
					array(
						'page'   => 'pods-add-new',
						'action' => '',
						'id'     => '',
						'do'     => '',
					)
				),
			),
			'search'           => false,
			'searchable'       => false,
			'sortable'         => true,
			'pagination'       => false,
			'extra'            => array(
				'total' => ', ' . number_format_i18n( $total_fields ) . ' ' . _n( 'field', 'fields', $total_fields, 'pods' ),
			),
		);

		if ( 1 < count( $pod_types_found ) ) {
			$ui['views']            = array( 'all' => __( 'All', 'pods' ) );
			$ui['view']             = $view;
			$ui['heading']          = array( 'views' => __( 'Type', 'pods' ) );
			$ui['filters_enhanced'] = true;

			foreach ( $pod_types_found as $pod_type => $number_found ) {
				$ui['views'][ $pod_type ] = $types[ $pod_type ];
			}
		}

		pods_ui( $ui );
	}
635829
def administration(self):
        """"""
        from ..manageags._services import AGSService
        url = self._url
        res = search("/rest/", url).span()
        addText = "/admin/"
        part1 = url[:res[1]].lower().replace('/rest/', '')
        part2 = url[res[1]:].lower().replace('/featureserver', ".mapserver")
        adminURL = "%s%s%s" % (part1, addText, part2)
        return AGSService(url=adminURL,
                          securityHandler=self._securityHandler,
                          proxy_url=self._proxy_url,
                          proxy_port=self._proxy_port,
                          initialize=False)
672493
def setup_admin_user_publisher():
    

    # ==== Setup User Admin === #

    admin_email = conf.APPLICATION_ADMIN_EMAIL
    if not admin_email:
        print("ERROR: APPLICATION_ADMIN_EMAIL is empty")
        exit()

    password = utils.generate_random_string()
    if user.setup(model.User,
                  admin_email=admin_email,
                  password=password):

        if mail.validated:
            body = "Admin Password: %s" % password
            mail.send(to=admin_email, subject="Admin Password", body=body)

        print("---- Setup SUPER ADMIN User ----")
        print("- Admin Email: %s" % admin_email)
        print("- Admin Password: %s" % password)
        print("-" * 40)
        print("")

    # ==== Setup Publisher === #

    # admin user
    admin_user = model.User.User.get_by_email(admin_email)

    # Set default categories and post types
    post_categories = ["Uncategorized"]
    post_types = ["Page", "Blog", "Document", "Other"]

    if admin_user and admin_user.role.name.lower() == "superadmin":
        print("---- Setup PUBLISHER ----")
        if publisher.setup(model.Publisher,
                           admin_user_id=admin_user.id,
                           post_types=post_types,
                           post_categories=post_categories):
            print("Completed")
        print("-" * 40)
        print("")
228456
public static void setUpUsers() {
        LOG.info("SETTING UP THE USERS TO BE USED ");
        adminUser = userProps.getProperty("adminUsername");
        adminUserPassword = userProps.getProperty("adminPassword");
        LOG.info("COMPLETED USER SETUP ");
    }
725945
public function setupAcl() {
        $adminAlias = Configure::read('Admin.aliases.administrator');

        $this->out(sprintf('Administrator Role: <info>%s</info>', $adminAlias));

        $answer = mb_strtoupper($this->in('Is this correct?', array('Y', 'N')));

        if ($answer === 'N') {
            $this->out('<warning>Configure the role through Admin.aliases.administrator</warning>');
            return false;
        }

        $admin = $this->RequestObject->addObject($adminAlias);
        $userModel = ClassRegistry::init($this->usersModel, true);

        // Fetch user
        $this->out('What user would you like to give admin access?');
        $user_id = $this->findUser();

        // Give access
        $result = $this->RequestObject->addChildObject(
            $this->user[$userModel->alias][$userModel->displayField],
            $admin['RequestObject']['id'],
            $this->usersModel,
            $user_id);

        if (!$result) {
            $this->err('<error>Failed to give user admin access</error>');
            return false;
        }

        $this->out('<success>Access granted, proceeding...</success>');
        $this->plugin('Admin');
        $this->plugin(Configure::read('Admin.coreName'));

        return true;
    }
437575
def _setup(app, *, schema,  title=None, app_key=APP_KEY, db=None):
    """"""

    admin = web.Application(loop=app.loop)
    app[app_key] = admin
    loader = jinja2.FileSystemLoader([TEMPLATES_ROOT, ])
    aiohttp_jinja2.setup(admin, loader=loader, app_key=TEMPLATE_APP_KEY)

    if title:
        schema.title = title

    resources = [
        init(db, info['table'], url=info['url'])
        for init, info in schema.resources
    ]

    admin_handler = AdminOnRestHandler(
        admin,
        resources=resources,
        loop=app.loop,
        schema=schema,
    )

    admin['admin_handler'] = admin_handler
    setup_admin_on_rest_handlers(admin, admin_handler)

    return admin
599498
protected function addAdmin()
    {
        if ($this->module->userComponent !== true) {
            return $this->addInheritedAdmin();
        }
        $transaction = $this->db->beginTransaction();
        try {
            $admin = new User();
            $admin->setScenario('installation');
            $admin->setAttributes([
                'username' => self::DEFAULT_USERNAME,
                'status' => User::STATUS_ACTIVE,
                'role' => User::ROLE_ADMIN,
            ], false);
            $admin->generateAuthKey();
            $admin->setPassword(self::DEFAULT_USERNAME);
            if (!$admin->save()) {
                throw new Exception(VarDumper::dumpAsString($admin->errors));
            }
            if (!$this->authManager->assign($this->authManager->getRole(Rbac::ROLE_ADMIN), $admin->id)) {
                throw new Exception('Error during Administrator privileges setting!');
            }
            $transaction->commit();
            return $this->returnSuccess(
                Yii::t('podium/flash', 'Administrator account has been created.')
                . ' ' . Html::tag('strong', Yii::t('podium/flash', 'Login') . ':')
                . ' ' . Html::tag('kbd', self::DEFAULT_USERNAME)
                . ' ' . Html::tag('strong', Yii::t('podium/flash', 'Password') . ':')
                . ' ' . Html::tag('kbd', self::DEFAULT_USERNAME)
                . '<br>'
                . Html::tag('strong', Yii::t('podium/flash', 'Remember to change these credentials after first login!'), ['class' => 'text-danger'])
            );
        } catch (Exception $e) {
            $transaction->rollBack();
            return $this->returnError($e->getMessage(), __METHOD__,
                Yii::t('podium/flash', 'Error during account creating')
            );
        }
    }
1111809
def setup(**kwargs):
    """"""

    cmdclass = kwargs.setdefault('cmdclass', {})
    cmdclass['easy_install'] = easy_install
    cmdclass['install'] = install
    cmdclass['register'] = register
    cmdclass['upload'] = upload
    cmdclass['upload_docs'] = upload_docs
    return setuptools.setup(**kwargs)
336320
public function runCreateAdmin()
    {
        $admin = $this->getContainer()->get('fos_user.user_manager')->findOneBy(
            [
                'username' => 'admin',
            ]
        );

        if (!$admin) {
            $this->runCommand(
                'fos:user:create',
                [
                    '--super-admin' => true,
                    'username' => 'admin',
                    'email' => 'admin@admin.com',
                    'password' => 'admin',
                ]
            );
        }
    }
216078
private function createAdminUser()
    {
        $user = factory(User::class)->create(
            [
            'firstName' => $this->ADMIN_FIRST_NAME,
            'lastName' => $this->ADMIN_LAST_NAME,
            'slug' => str_slug($this->ADMIN_FIRST_NAME.'-'.$this->ADMIN_LAST_NAME),
            'email' => $this->ADMIN_EMAIL,
            'password' => Hash::make($this->ADMIN_PASSWORD),
            'isActive' => true
            ]
        );

        // assign role
        $user->assignRoles(UserGroup::getAdminGroup()->groupID, true);
    }
1167005
def create_admin_set_password(self, password):
        
        with open(self.sitedir + '/run/admin.json', 'w') as out:
            json.dump({
                'name': 'admin',
                'email': 'none',
                'password': password,
                'sysadmin': True},
                out)
        self.user_run_script(
            script=scripts.get_script_path('update_add_admin.sh'),
            args=[],
            db_links=True,
            ro={
                self.sitedir + '/run/admin.json': '/input/admin.json'
               },
            )
        remove(self.sitedir + '/run/admin.json')
753933
function setUpBehat() {
    // Ensure that this system has headless Chrome.
    if (!$this->taskExec('which chromedriver')->run()->wasSuccessful()) {
      $os = exec('uname');
      // Here we assume either OS X (a dev's env) or not (a CI env).
      if ($os == 'Darwin') {
        $this->taskExec('brew install chromedriver')
          ->run();
      }
      else {
        $version = exec('curl http://chromedriver.storage.googleapis.com/LATEST_RELEASE');
        $this->taskExec("wget http://chromedriver.storage.googleapis.com/{$version}/chromedriver_linux64.zip")
          ->run();
        $this->taskExec('unzip chromedriver_linux64.zip')
          ->run();
        $this->taskFilesystemStack()
          ->rename('chromedriver', 'vendor/bin/chromedriver')
          ->run();
        $this->taskFilesystemStack()
          ->remove('chromedriver_linux64.zip')
          ->run();
      }
    }
  }
1183498
def manage_admins():
    """"""
    build = g.build

    # Do not show cached data
    db.session.add(build)
    db.session.refresh(build)

    add_form = forms.AddAdminForm()
    if add_form.validate_on_submit():

        invitation_user_id = '%s:%s' % (
            models.User.EMAIL_INVITATION, add_form.email_address.data)

        invitation_user = models.User.query.get(invitation_user_id)
        if not invitation_user:
            invitation_user = models.User(
                id=invitation_user_id,
                email_address=add_form.email_address.data)
            db.session.add(invitation_user)

        db.session.add(build)
        db.session.add(invitation_user)
        db.session.refresh(build, lockmode='update')

        build.owners.append(invitation_user)
        save_admin_log(build, invited_new_admin=True,
                       message=invitation_user.email_address)

        db.session.commit()

        logging.info('Added user=%r as owner to build_id=%r',
                     invitation_user.id, build.id)
        return redirect(url_for('manage_admins', build_id=build.id))

    add_form.build_id.data = build.id

    revoke_form_list = []
    for user in build.owners:
        form = forms.RemoveAdminForm()
        form.user_id.data = user.id
        form.build_id.data = build.id
        form.revoke.data = True
        revoke_form_list.append((user, form))

    return render_template(
        'view_admins.html',
        build=build,
        add_form=add_form,
        revoke_form_list=revoke_form_list)
1365427
def admin?
    is_admin = ( ENV['USER'] == 'root' )
    unless is_admin
      ext_admin = exec(:check_admin) do |op, results|
        if op == :reduce
          results.values.include?(true)
        else
          results ? true : false
        end
      end
    end
    is_admin || ext_admin ? true : false
  end
1064292
public function createAdministratorController()
    {
        $controller = $this->directory.'/Controllers/AdministratorController.php';
        $contents = $this->getStub('AdministratorController');

        $this->laravel['files']->put(
            $controller,
            str_replace('DummyNamespace', Admin::controllerNamespace(), $contents)
        );
        $this->line(
            '<info>AdministratorController file was created:</info> '.str_replace(base_path(), '', $controller)
        );
    }
974990
def setup_dir(self):
        """"""
        cd = self.opts.cd or self.config['crony'].get('directory')
        if cd:
            self.logger.debug(f'Adding cd to {cd}')
            self.cmd = f'cd {cd} && {self.cmd}'