Source of file AWSEnvironment.php
Size: 2,281 Bytes - Last Modified: 2021-12-23T10:38:09+00:00
/var/www/docs.ssmods.com/process/src/code/AWSEnvironment.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 | <?php /** * AWSEnvironment * * Example of using another DeploymentBackend for https://github.com/silverstripe/deploynaut * */ class AWSEnvironment extends DNEnvironment { /** * @var array */ public static $db = array( 'SnowcakeName' => 'Varchar(255)' ); private static $singular_name = 'Snowcake Environment'; private static $plural_name = 'Snowcake Environments'; public function Backend() { return Object::create_from_string("SnowcakeDeploymentBackend"); } /** * @return FieldList */ public function getCMSFields() { $project = $this->Project(); if($project && $project->exists()) { $viewerGroups = $project->Viewers(); $groups = $viewerGroups->sort('Title')->map()->toArray(); $members = array(); foreach($viewerGroups as $group) { foreach($group->Members()->map() as $k => $v) { $members[$k] = $v; } } asort($members); } else { $groups = array(); $members = array(); } $fields = new FieldList(new TabSet('Root')); $fields->addFieldsToTab('Root.Main', array( // The Main.ProjectID TextField::create('ProjectName', 'Project') ->setValue(($project = $this->Project()) ? $project->Name : null) ->performReadonlyTransformation(), // The Main.Name TextField::create('Name', 'Environment name') ->setDescription('A descriptive name for this environment, e.g. staging, uat, production'), // The Main.URL field TextField::create('URL', 'Server URL') ->setDescription('This url will be used to provide the front-end with a link to this environment'), TextField::create('SnowcakeName', 'Snowcake deploy name') ->setDescription('This must be the same as the snowcake folder name in the projects/ folder'), )); $fields->addFieldsToTab('Root.UserPermissions', array( // The viewers of the environment $this ->buildPermissionField('ViewerGroups', 'Viewers', $groups, $members) ->setTitle('Who can view this environment?') ->setDescription('Groups or Users who can view this environment'), // The Main.Deployers $this ->buildPermissionField('DeployerGroups', 'Deployers', $groups, $members) ->setTitle('Who can deploy?') ->setDescription('Groups or Users who can deploy to this environment'), )); return $fields; } } |