diff --git a/core/modules/user/lib/Drupal/user/Plugin/Action/AddRoleUser.php b/core/modules/user/lib/Drupal/user/Plugin/Action/AddRoleUser.php
index f1d1f37..e65a2db 100644
--- a/core/modules/user/lib/Drupal/user/Plugin/Action/AddRoleUser.php
+++ b/core/modules/user/lib/Drupal/user/Plugin/Action/AddRoleUser.php
@@ -28,12 +28,11 @@ class AddRoleUser extends ChangeUserRoleBase {
   public function execute($account = NULL) {
     $rid = $this->configuration['rid'];
     // Skip adding the role to the user if they already have it.
-    if ($account !== FALSE && !isset($account->roles[$rid])) {
-      $roles = $account->roles + array($rid => $rid);
+    if ($account !== FALSE && !in_array($rid, $account->getRoles())) {
       // For efficiency manually save the original account before applying
       // any changes.
       $account->original = clone $account;
-      $account->roles = $roles;
+      $account->addRole($rid);
       $account->save();
     }
   }
diff --git a/core/modules/user/lib/Drupal/user/Plugin/Action/RemoveRoleUser.php b/core/modules/user/lib/Drupal/user/Plugin/Action/RemoveRoleUser.php
index a2b2616..a869c7e 100644
--- a/core/modules/user/lib/Drupal/user/Plugin/Action/RemoveRoleUser.php
+++ b/core/modules/user/lib/Drupal/user/Plugin/Action/RemoveRoleUser.php
@@ -28,12 +28,11 @@ class RemoveRoleUser extends ChangeUserRoleBase {
   public function execute($account = NULL) {
     $rid = $this->configuration['rid'];
     // Skip removing the role from the user if they already don't have it.
-    if ($account !== FALSE && isset($account->roles[$rid])) {
-      $roles = array_diff($account->roles, array($rid => $rid));
+    if ($account !== FALSE && in_array($rid, $account->getRoles())) {
       // For efficiency manually save the original account before applying
       // any changes.
       $account->original = clone $account;
-      $account->roles = $roles;
+      $account->removeRole($rid);
       $account->save();
     }
   }
diff --git a/core/modules/user/lib/Drupal/user/Plugin/Core/Entity/User.php b/core/modules/user/lib/Drupal/user/Plugin/Core/Entity/User.php
index 6c95606..cd90df3 100644
--- a/core/modules/user/lib/Drupal/user/Plugin/Core/Entity/User.php
+++ b/core/modules/user/lib/Drupal/user/Plugin/Core/Entity/User.php
@@ -236,4 +236,31 @@ public function getBCEntity() {
     return $this->bcEntity;
   }
 
+  /**
+   * {@inheritdoc}
+   */
+  public function getRoles() {
+    $roles = array();
+    foreach ($this->get('roles') as $role) {
+      $roles[] = $role->value;
+    }
+    return $roles;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function addRole($rid) {
+    $roles = $this->getRoles();
+    $roles[] = $rid;
+    $this->set('roles', array_unique($roles));
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function removeRole($rid) {
+    $this->set('roles', array_diff($this->getRoles(), array($rid)));
+  }
+
 }
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserEntityTest.php b/core/modules/user/lib/Drupal/user/Tests/UserEntityTest.php
new file mode 100644
index 0000000..19bd054
--- /dev/null
+++ b/core/modules/user/lib/Drupal/user/Tests/UserEntityTest.php
@@ -0,0 +1,67 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\user\Tests\UserEntityTest.
+ */
+
+namespace Drupal\user\Tests;
+
+use Drupal\Core\Language\Language;
+use Drupal\simpletest\DrupalUnitTestBase;
+use Drupal\user\Plugin\Core\Entity\User;
+
+/**
+ * Tests the user entity class.
+ *
+ * @see \Drupal\user\Plugin\Core\Entity\User
+ */
+class UserEntityTest extends DrupalUnitTestBase {
+
+  /**
+   * Modules to enable.
+   *
+   * @var array
+   */
+  public static $modules = array('system', 'user');
+
+  public static function getInfo() {
+    return array(
+      'name' => 'User entity tests',
+      'description' => 'Tests the user entity class.',
+      'group' => 'User'
+    );
+  }
+
+  /**
+   * Tests some of the methods.
+   *
+   * @see \Drupal\user\Plugin\Core\Entity\User::getRoles()
+   * @see \Drupal\user\Plugin\Core\Entity\User::addRole()
+   * @see \Drupal\user\Plugin\Core\Entity\User::removeRole()
+   */
+  public function testUserMethods() {
+    $role_storage = $this->container->get('plugin.manager.entity')->getStorageController('user_role');
+    $role_storage->create(array('id' => 'test_role_one'))->save();
+    $role_storage->create(array('id' => 'test_role_two'))->save();
+    $role_storage->create(array('id' => 'test_role_three'))->save();
+
+    $values = array('roles' => array(Language::LANGCODE_DEFAULT => array('test_role_one')));
+    $user = new User($values, 'user');
+
+    $this->assertEqual(array('test_role_one'), $user->getRoles());
+
+    $user->addRole('test_role_one');
+    $this->assertEqual(array('test_role_one'), $user->getRoles());
+
+    $user->addRole('test_role_two');
+    $this->assertEqual(array('test_role_one', 'test_role_two'), $user->getRoles());
+
+    $user->removeRole('test_role_three');
+    $this->assertEqual(array('test_role_one', 'test_role_two'), $user->getRoles());
+
+    $user->removeRole('test_role_one');
+    $this->assertEqual(array('test_role_two'), $user->getRoles());
+  }
+
+}
diff --git a/core/modules/user/lib/Drupal/user/UserBCDecorator.php b/core/modules/user/lib/Drupal/user/UserBCDecorator.php
index 586bc0a..fe6afb5 100644
--- a/core/modules/user/lib/Drupal/user/UserBCDecorator.php
+++ b/core/modules/user/lib/Drupal/user/UserBCDecorator.php
@@ -29,4 +29,26 @@ public function &__get($name) {
     }
     return parent::__get($name);
   }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getRoles() {
+    return $this->getBCEntity()->getRoles();
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function addRole($rid) {
+    $this->getBCEntity()->addRole($rid);
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function removeRole($rid) {
+    $this->getBCEntity()->removeRole($rid);
+  }
+
 }
diff --git a/core/modules/user/lib/Drupal/user/UserInterface.php b/core/modules/user/lib/Drupal/user/UserInterface.php
index 3a98dd5..68dedae 100644
--- a/core/modules/user/lib/Drupal/user/UserInterface.php
+++ b/core/modules/user/lib/Drupal/user/UserInterface.php
@@ -14,4 +14,28 @@
  */
 interface UserInterface extends EntityInterface {
 
+  /**
+   * Returns a list of roles.
+   *
+   * @return array
+   *   List of role IDs.
+   */
+  public function getRoles();
+
+  /**
+   * Add a role to a user.
+   *
+   * @param string $rid
+   *   The role ID to add.
+   */
+  public function addRole($rid);
+
+  /**
+   * Remove a role from a user.
+   *
+   * @param string $rid
+   *   The role ID to remove.
+   */
+  public function removeRole($rid);
+
 }
diff --git a/core/modules/user/tests/Drupal/user/Tests/Plugin/Action/AddRoleUserTest.php b/core/modules/user/tests/Drupal/user/Tests/Plugin/Action/AddRoleUserTest.php
new file mode 100644
index 0000000..ed2f9c2
--- /dev/null
+++ b/core/modules/user/tests/Drupal/user/Tests/Plugin/Action/AddRoleUserTest.php
@@ -0,0 +1,71 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\user\Tests\Plugin\Action\AddRoleUserTest.
+ */
+
+namespace Drupal\user\Tests\Plugin\Action;
+
+use Drupal\Tests\UnitTestCase;
+use Drupal\user\Plugin\Action\AddRoleUser;
+use Drupal\user\Plugin\Action\RemoveRoleUser;
+
+/**
+ * Tests the role add plugin.
+ *
+ * @see \Drupal\user\Plugin\Action\AddRoleUser
+ */
+class AddRoleUserTest extends UnitTestCase {
+
+  public static function getInfo() {
+    return array(
+      'name' => 'Add user plugin',
+      'description' => 'Tests the role add plugin',
+      'group' => 'User',
+    );
+  }
+
+  /**
+   * Tests the execute method on a user with a role.
+   */
+  public function testExecuteAddExistingRole() {
+    $account = $this->getMockBuilder('Drupal\user\Plugin\Core\Entity\User')
+      ->disableOriginalConstructor()
+      ->getMock();
+
+    $account->expects($this->any())
+      ->method('getRoles')
+      ->will($this->returnValue(array('test_role_1', 'test_role_2')));
+
+    $account->expects($this->never())
+      ->method('addRole');
+
+    $config = array('rid' => 'test_role_1');
+    $remove_role_plugin = new AddRoleUser($config, 'user_remove_role_action', array('type' => 'user'));
+
+    $remove_role_plugin->execute($account);
+  }
+
+  /**
+   * Tests the execute method on a user without a specific role.
+   */
+  public function testExecuteAddNonExistingRole() {
+    $account = $this->getMockBuilder('Drupal\user\Plugin\Core\Entity\User')
+      ->disableOriginalConstructor()
+      ->getMock();
+
+    $account->expects($this->any())
+      ->method('getRoles')
+      ->will($this->returnValue(array('test_role_2')));
+
+    $account->expects($this->once())
+      ->method('addRole');
+
+    $config = array('rid' => 'test_role_1');
+    $remove_role_plugin = new AddRoleUser($config, 'user_remove_role_action', array('type' => 'user'));
+
+    $remove_role_plugin->execute($account);
+  }
+
+}
diff --git a/core/modules/user/tests/Drupal/user/Tests/Plugin/Action/RemoveRoleUserTest.php b/core/modules/user/tests/Drupal/user/Tests/Plugin/Action/RemoveRoleUserTest.php
new file mode 100644
index 0000000..370c2f8
--- /dev/null
+++ b/core/modules/user/tests/Drupal/user/Tests/Plugin/Action/RemoveRoleUserTest.php
@@ -0,0 +1,70 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\user\Tests\Plugin\Action\RemoveRoleUserTest.
+ */
+
+namespace Drupal\user\Tests\Plugin\Action;
+
+use Drupal\Tests\UnitTestCase;
+use Drupal\user\Plugin\Action\RemoveRoleUser;
+
+/**
+ * Tests the role remove plugin.
+ *
+ * @see \Drupal\user\Plugin\Action\RemoveRoleUser
+ */
+class RemoveRoleUserTest extends UnitTestCase {
+
+  public static function getInfo() {
+    return array(
+      'name' => 'Remove user plugin',
+      'description' => 'Tests the role remove plugin',
+      'group' => 'User',
+    );
+  }
+
+  /**
+   * Tests the execute method on a user with a role.
+   */
+  public function testExecuteRemoveExistingRole() {
+    $account = $this->getMockBuilder('Drupal\user\Plugin\Core\Entity\User')
+      ->disableOriginalConstructor()
+      ->getMock();
+
+    $account->expects($this->any())
+      ->method('getRoles')
+      ->will($this->returnValue(array('test_role_1', 'test_role_2')));
+
+    $account->expects($this->once())
+      ->method('removeRole');
+
+    $config = array('rid' => 'test_role_1');
+    $remove_role_plugin = new RemoveRoleUser($config, 'user_remove_role_action', array('type' => 'user'));
+
+    $remove_role_plugin->execute($account);
+  }
+
+  /**
+   * Tests the execute method on a user without a specific role.
+   */
+  public function testExecuteRemoveNonExistingRole() {
+    $account = $this->getMockBuilder('Drupal\user\Plugin\Core\Entity\User')
+      ->disableOriginalConstructor()
+      ->getMock();
+
+    $account->expects($this->any())
+      ->method('getRoles')
+      ->will($this->returnValue(array('test_role_2')));
+
+    $account->expects($this->never())
+      ->method('removeRole');
+
+    $config = array('rid' => 'test_role_1');
+    $remove_role_plugin = new RemoveRoleUser($config, 'user_remove_role_action', array('type' => 'user'));
+
+    $remove_role_plugin->execute($account);
+  }
+
+}
