     1: <?php
     2: /**
     3:  * Copyright 2012-2014 Rackspace US, Inc.
     4:  *
     5:  * Licensed under the Apache License, Version 2.0 (the "License");
     6:  * you may not use this file except in compliance with the License.
     7:  * You may obtain a copy of the License at
     8:  *
     9:  * http://www.apache.org/licenses/LICENSE-2.0
    10:  *
    11:  * Unless required by applicable law or agreed to in writing, software
    12:  * distributed under the License is distributed on an "AS IS" BASIS,
    13:  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14:  * See the License for the specific language governing permissions and
    15:  * limitations under the License.
    16:  */
    17:
    18: namespace OpenCloud\Identity\Resource;
    19:
    20: use OpenCloud\Common\PersistentObject;
    21:
    22: /**
    23:  * A role object represents a role that a User has.
    24:  *
    25:  * A role is a personality that a user assumes when performing a
    26:  * specific set of operations. A role includes a set of rights and privileges. A user assuming a role inherits the
    27:  * rights and privileges associated with the role. A token that is issued to a user includes the list of roles the user
    28:  * can assume. When a user calls a service, that service determines how to interpret a user's roles. A role that grants
    29:  * access to a list of operations or resources within one service may grant access to a completely different list when
    30:  * interpreted by a different service.
    31:  *
    32:  * @package OpenCloud\Identity\Resource
    33:  */
    34: class Role extends PersistentObject
    35: {
    36:     /** @var string The role ID */
    37:     private $id;
    38:
    39:     /** @var string The role name */
    40:     private $name;
    41:
    42:     /** @var string The role description */
    43:     private $description;
    44:
    45:     protected static $url_resource = 'OS-KSADM/roles';
    46:     protected static $json_name = 'role';
    47:
    48:     /**
    49:      * @param $id Sets the ID
    50:      */
    51:     public function setId($id)
    52:     {
    53:         $this->id = $id;
    54:     }
    55:
    56:     /**
    57:      * @return string Returns the ID
    58:      */
    59:     public function getId()
    60:     {
    61:         return $this->id;
    62:     }
    63:
    64:     /**
    65:      * @param $name Sets the name
    66:      */
    67:     public function setName($name)
    68:     {
    69:         $this->name = $name;
    70:     }
    71:
    72:     /**
    73:      * @return string Returns the name
    74:      */
    75:     public function getName()
    76:     {
    77:         return $this->name;
    78:     }
    79:
    80:     /**
    81:      * @param $description Sets the description
    82:      */
    83:     public function setDescription($description)
    84:     {
    85:         $this->description = $description;
    86:     }
    87:
    88:     /**
    89:      * @return string Returns the description
    90:      */
    91:     public function getDescription()
    92:     {
    93:         return $this->description;
    94:     }
    95: }
    96: