Remove all occurrences of ``permission`` from ``payload``.
773265
def remove_permission(payload, permission):
    """"""
    payload = copy.deepcopy(payload)

    for entity_type in ['users', 'groups']:
        for perm_type in ['add', 'remove']:
            for perms in payload.get(entity_type, {}).get(perm_type, {}).values():
                if permission in perms:
                    perms.remove(permission)

    for perm_type in ['add', 'remove']:
        perms = payload.get('public', {}).get(perm_type, [])
        if permission in perms:
            perms.remove(permission)

    return payload
576498
def drop_privileges ():
    """"""
    if os.name != 'posix':
        return
    if os.geteuid() == 0:
        log.warn(LOG_CHECK, _("Running as root user; "
                       "dropping privileges by changing user to nobody."))
        import pwd
        os.seteuid(pwd.getpwnam('nobody')[3])
357438
def del_permission(self, role, name):
        
        if not self.has_permission(role, name):
            return True
        targetGroup = AuthGroup.objects(role=role, creator=self.client).first()
        target = AuthPermission.objects(groups=targetGroup, name=name, creator=self.client).first()
        if not target:
            return True
        target.delete()
        return True
170029
def clear(self):
        
        self._searchEdit.blockSignals(True)
        self._searchEdit.setText('')
        self._searchEdit.blockSignals(False)
374646
def remove_values(self, names):
        """"""
        for name in names:
            self.shellwidget.remove_value(name)
        self.shellwidget.refresh_namespacebrowser()
167808
def remove_p(self):
        
        try:
            self.unlink()
        except OSError:
            _, e, _ = sys.exc_info()
            if e.errno != errno.ENOENT:
                raise
        return self
813217
def clearAnnouncements(self):
        
        try:
            q = models.Announcement.delete().where(
                models.Announcement.id > 0)
            q.execute()
        except Exception as e:
            raise exceptions.RepoManagerException(e)
1047476
def reset_permission_factories(self):
        """"""
        for key in ('read', 'create', 'update', 'delete'):
            full_key = '{0}_permission_factory'.format(key)
            if full_key in self.__dict__:
                del self.__dict__[full_key]
82617
def refresh_permissions(permissions):
    """"""
    available_permissions = [x.codename for x in
                             Permission.objects.filter(
                                 codename__startswith=ACL_CODE_PREFIX)]
    active_permissions = permissions.keys()

    perms_to_add = set(active_permissions) - set(available_permissions)
    perms_to_remove = set(available_permissions) - set(active_permissions)

    # Remove deprecated permissions
    for codename in perms_to_remove:
        Permission.objects.filter(codename=codename).delete()

    # Add generated permissions
    ct = ContentType.objects.get_for_model(model=auth_models.User)
    for codename in perms_to_add:
        Permission.objects.get_or_create(codename=codename,
                                         name=permissions[codename],
                                         content_type=ct)
924771
def remove(env, securitygroup_id, rule_id):
    """"""
    mgr = SoftLayer.NetworkManager(env.client)

    ret = mgr.remove_securitygroup_rule(securitygroup_id, rule_id)

    if not ret:
        raise exceptions.CLIAbort("Failed to remove security group rule")

    table = formatting.Table(REQUEST_BOOL_COLUMNS)
    table.add_row([ret['requestId']])

    env.fout(table)
212481
def clear_content(self):
        
        if self.sectPr is not None:
            content_elms = self[:-1]
        else:
            content_elms = self[:]
        for content_elm in content_elms:
            self.remove(content_elm)
197247
public function removePermission(
        UUID $uuid,
        Permission $permission
    ) {
        if (in_array($permission, $this->permissions)) {
            $this->apply(new PermissionRemoved($uuid, $permission));
        }
    }
876626
def remove_permission(self, label, callback=None):
        
        return self.connection.remove_permission(self, label, callback=callback)
870248
def removeRandomLenPadding(str, blocksize=AES_blocksize):
  ''
  pad_len = ord(str[-1]) # last byte contains number of padding bytes
  assert pad_len < blocksize, 'padding error' 
  assert pad_len < len(str), 'padding error'
    
  return str[:-pad_len]
674090
def delete_permission(self, vname, username):
        
        vname = quote(vname, '')
        path = Client.urls['vhost_permissions'] % (vname, username)
        return self._call(path, 'DELETE')
758193
def remove_handler():
    """"""
    logger.debug("[#] Removing user, group and permissions for Blockade")
    client = boto3.client("iam", region_name=PRIMARY_REGION)

    iam = boto3.resource('iam')
    account_id = iam.CurrentUser().arn.split(':')[4]

    try:
        logger.debug("[#] Removing %s from %s group" % (BLOCKADE_USER, BLOCKADE_GROUP))
        response = client.remove_user_from_group(
            GroupName=BLOCKADE_GROUP,
            UserName=BLOCKADE_USER
        )
    except client.exceptions.NoSuchEntityException:
        logger.debug("[!] Blockade user already removed from group")

    for label in BLOCKADE_POLICIES + ['PushToCloud', 'APIGatewayAdmin']:
        logger.debug("[#] Removing %s policy" % (label))
        arn = 'arn:aws:iam::{id}:policy/{policy}'.format(id=account_id,
                                                         policy=label)
        if label == 'PushToCloud':
            arn = "arn:aws:iam::aws:policy/service-role/AmazonAPIGatewayPushToCloudWatchLogs"
        if label == 'APIGatewayAdmin':
            arn = "arn:aws:iam::aws:policy/AmazonAPIGatewayAdministrator"

        try:
            response = client.detach_group_policy(
                GroupName=BLOCKADE_GROUP, PolicyArn=arn)
        except:
            pass
        try:
            response = client.detach_role_policy(
                RoleName=BLOCKADE_ROLE, PolicyArn=arn)
        except:
            pass
        try:
            response = client.delete_policy(PolicyArn=arn)
        except Exception as e:
            print(e)
            pass
    logger.debug("[#] Removed all policies")

    try:
        logger.debug("[#] Deleting %s user" % (BLOCKADE_USER))
        response = client.delete_user(
            UserName=BLOCKADE_USER
        )
    except client.exceptions.NoSuchEntityException:
        logger.debug("[!] %s user already deleted" % (BLOCKADE_USER))

    try:
        logger.debug("[#] Removing %s group" % (BLOCKADE_GROUP))
        response = client.delete_group(GroupName=BLOCKADE_GROUP)
    except:
        logger.debug("[!] Group already removed")

    try:
        logger.debug("[#] Removing %s role" % (BLOCKADE_ROLE))
        response = client.delete_role(RoleName=BLOCKADE_ROLE)
    except:
        logger.debug("[!] Role already removed")

    return True
592220
function removeRolePrivilege (access, role, privilege) {
  if (role === true) {
    access[privilege] = {
      role: []
    }
    return
  }

  if (access[privilege].role === true) {
    access[privilege].role = true
  }

  _.pullAll(access[privilege].role, _.concat(role))
}