has() 공개 정적인 메소드

Checks if specified resource is defined
public static has ( integer $resourceId ) : boolean
$resourceId integer The ID of the ACL resource
리턴 boolean Returns true if defined or false otherwise
예제 #1
0
 protected function validateBefore1($stage)
 {
     return defined('Scalr\\Acl\\Acl::RESOURCE_WEBHOOKS_ENVIRONMENT') && Definition::has(Acl::RESOURCE_WEBHOOKS_ENVIRONMENT);
 }
예제 #2
0
 protected function validateBefore1($stage)
 {
     return defined('Scalr\\Acl\\Acl::RESOURCE_ADMINISTRATION_WEBHOOKS') && Definition::has(Acl::RESOURCE_ADMINISTRATION_WEBHOOKS);
 }
예제 #3
0
 protected function validateBefore1($stage)
 {
     return defined('Scalr\\Acl\\Acl::RESOURCE_ORPHANED_SERVERS') && Definition::has(Acl::RESOURCE_ORPHANED_SERVERS);
 }
예제 #4
0
 protected function validateBefore4($stage)
 {
     return defined('Scalr\\Acl\\Acl::RESOURCE_CLOUD_CREDENTIALS_ACCOUNT') && Definition::has(Acl::RESOURCE_CLOUD_CREDENTIALS_ACCOUNT);
 }
예제 #5
0
 /**
  * Check if stage is applied for the specified resource and permission
  *
  * @param    string    $resourceName   The name of the ACL resource (Example:"RESOURCE_FARMS")
  * @param    string    $permissionName The name of the ACL permission (Example:"PERM_FARMS_SERVERS")
  * @return   boolean
  */
 private function checkAppliedForPermission($resourceName, $permissionName)
 {
     return defined('Scalr\\Acl\\Acl::' . $resourceName) && defined('Scalr\\Acl\\Acl::' . $permissionName) && Definition::has(constant('Scalr\\Acl\\Acl::' . $resourceName)) && $this->db->GetOne("\n                    SELECT `granted` FROM `acl_role_resource_permissions`\n                    WHERE `resource_id` = ? AND `role_id` = ? AND `perm_id` = ?\n                    LIMIT 1\n                ", [constant('Scalr\\Acl\\Acl::' . $resourceName), Acl::ROLE_ID_FULL_ACCESS, constant('Scalr\\Acl\\Acl::' . $permissionName)]) == 1;
 }
예제 #6
0
 protected function validateBefore2($stage)
 {
     return defined('Scalr\\Acl\\Acl::RESOURCE_ADMINISTRATION_ORCHESTRATION') && Definition::has(Acl::RESOURCE_ADMINISTRATION_ORCHESTRATION);
 }
예제 #7
0
 protected function validateBefore1($stage)
 {
     return defined('Scalr\\Acl\\Acl::RESOURCE_AWS_ROUTE53') && defined('Scalr\\Acl\\Acl::RESOURCE_ANALYTICS_PROJECTS') && Definition::has(Acl::RESOURCE_AWS_ROUTE53) && Definition::has(Acl::RESOURCE_ANALYTICS_PROJECTS);
 }
예제 #8
0
 protected function validateBefore2($stage)
 {
     return defined('Scalr\\Acl\\Acl::RESOURCE_ADMINISTRATION_ANALYTICS') && defined('Scalr\\Acl\\Acl::PERM_ADMINISTRATION_ANALYTICS_ALLOCATE_BUDGET') && Definition::has(Acl::RESOURCE_ADMINISTRATION_ANALYTICS) && $this->db->GetOne("\n                    SELECT `granted` FROM `acl_role_resources`\n                    WHERE `resource_id` = ? AND `role_id` = ?\n                    LIMIT 1\n                ", array(Acl::RESOURCE_ADMINISTRATION_ANALYTICS, Acl::ROLE_ID_FULL_ACCESS)) == 1;
 }
예제 #9
0
 protected function validateBefore6($stage)
 {
     return defined('Scalr\\Acl\\Acl::RESOURCE_FARMS') && Definition::has(Acl::RESOURCE_FARMS) && defined('Scalr\\Acl\\Acl::RESOURCE_TEAM_FARMS') && Definition::has(Acl::RESOURCE_TEAM_FARMS) && defined('Scalr\\Acl\\Acl::RESOURCE_OWN_FARMS') && Definition::has(Acl::RESOURCE_OWN_FARMS) && defined('Scalr\\Acl\\Acl::PERM_FARMS_PROJECTS');
 }
예제 #10
0
 protected function validateBefore1($stage)
 {
     return defined('Scalr\\Acl\\Acl::RESOURCE_ADMINISTRATION_GLOBAL_VARIABLES') && Definition::has(Acl::RESOURCE_ADMINISTRATION_GLOBAL_VARIABLES);
 }
예제 #11
0
 protected function validateBefore2($stage)
 {
     return defined('Scalr\\Acl\\Acl::RESOURCE_ENVADMINISTRATION_ANALYTICS') && Definition::has(Acl::RESOURCE_ENVADMINISTRATION_ANALYTICS);
 }
예제 #12
0
 protected function validateBefore1($stage)
 {
     return defined('Scalr\\Acl\\Acl::RESOURCE_FARMS_SERVERS') && defined('Scalr\\Acl\\Acl::PERM_FARMS_SERVERS_SSH_CONSOLE') && Definition::has(Acl::RESOURCE_FARMS_SERVERS) && $this->db->GetOne("\n                    SELECT `granted` FROM `acl_role_resources`\n                    WHERE `resource_id` = ? AND `role_id` = ?\n                    LIMIT 1\n                ", array(Acl::RESOURCE_FARMS_SERVERS, Acl::ROLE_ID_FULL_ACCESS)) == 1;
 }
예제 #13
0
 protected function validateBefore1($stage)
 {
     return defined('Scalr\\Acl\\Acl::RESOURCE_GENERAL_CUSTOM_EVENTS') && defined('Scalr\\Acl\\Acl::PERM_GENERAL_CUSTOM_EVENTS_FIRE') && Definition::has(Acl::RESOURCE_GENERAL_CUSTOM_EVENTS) && $this->db->GetOne("\n                    SELECT `granted` FROM `acl_role_resources`\n                    WHERE `resource_id` = ? AND `role_id` = ?\n                    LIMIT 1\n                ", array(Acl::RESOURCE_GENERAL_CUSTOM_EVENTS, Acl::ROLE_ID_FULL_ACCESS)) == 1;
 }
예제 #14
0
 protected function validateBefore4($stage)
 {
     return defined('Scalr\\Acl\\Acl::RESOURCE_SERVICES_ADMINISTRATION_CHEF') && Definition::has(Acl::RESOURCE_SERVICES_ADMINISTRATION_CHEF);
 }
예제 #15
0
 protected function validateBefore4($stage)
 {
     return defined('Scalr\\Acl\\Acl::RESOURCE_FARMS_IMAGES') && defined('Scalr\\Acl\\Acl::PERM_FARMS_IMAGES_CREATE') && Definition::has(Acl::RESOURCE_FARMS_IMAGES);
 }
예제 #16
0
 protected function validateBefore1($stage)
 {
     return defined('Scalr\\Acl\\Acl::RESOURCE_GLOBAL_VARIABLES_ACCOUNT') && Definition::has(Acl::RESOURCE_GLOBAL_VARIABLES_ACCOUNT);
 }
예제 #17
0
 protected function validateBefore3($stage)
 {
     return defined('Scalr\\Acl\\Acl::RESOURCE_GCE_SNAPSHOTS') && Definition::has(Acl::RESOURCE_GCE_SNAPSHOTS);
 }
예제 #18
0
 protected function validateBefore1($stage)
 {
     return defined('Scalr\\Acl\\Acl::RESOURCE_LOGS_EVENT_LOGS') && Definition::has(Acl::RESOURCE_LOGS_EVENT_LOGS);
 }
예제 #19
0
 protected function validateBefore1($stage)
 {
     return defined('Scalr\\Acl\\Acl::RESOURCE_DISCOVERY_SERVERS') && Definition::has(Acl::RESOURCE_DISCOVERY_SERVERS) && defined('Scalr\\Acl\\Acl::PERM_DISCOVERY_SERVERS_IMPORT');
 }
예제 #20
0
파일: Acl.php 프로젝트: recipe/scalr
 /**
  * Gets mnemonic names for all resources using constants
  *
  * This method excludes disabled resources.
  *
  * @return  array Returns all resources looks like array(resourceId => mnemonicIndex)
  */
 public static function getResourcesMnemonic()
 {
     $res = array();
     $refl = new \ReflectionClass(get_called_class());
     foreach ($refl->getConstants() as $name => $resourceId) {
         if (strpos($name, 'RESOURCE_') === 0 && Resource\Definition::has($resourceId)) {
             $res[$resourceId] = substr($name, 9);
         }
     }
     //Removes disabled resources
     foreach (self::getDisabledResources() as $resourceId) {
         if (isset($res[$resourceId])) {
             unset($res[$resourceId]);
         }
     }
     return $res;
 }
예제 #21
0
 protected function validateBefore4($stage)
 {
     return defined('Scalr\\Acl\\Acl::RESOURCE_SERVICES_CHEF_ACCOUNT') && Definition::has(Acl::RESOURCE_SERVICES_CHEF_ACCOUNT);
 }
예제 #22
0
 protected function validateBefore2($stage)
 {
     return defined('Scalr\\Acl\\Acl::RESOURCE_AWS_S3') && Definition::has(Acl::RESOURCE_AWS_S3);
 }
예제 #23
0
 protected function validateBefore2($stage)
 {
     return defined('Scalr\\Acl\\Acl::RESOURCE_ANNOUNCEMENTS') && Definition::has(Acl::RESOURCE_ANNOUNCEMENTS);
 }