Revoke an admin
---------------
returns true on success
required parameter <admin_id> = _id value of the admin to revoke, can be obtained using the
list_all_admins() method/function

NOTES:
only non-superadmins account can be revoked
963542
public function revoke_admin($admin_id)
    {
        if (!$this->is_loggedin) {
            return false;
        }

        $payload  = ['cmd' => 'revoke-admin', 'admin' => $admin_id];
        $response = $this->exec_curl('/api/s/' . $this->site . '/cmd/sitemgr', $payload);

        return $this->process_response_boolean($response);
    }
881438
def revoke_user_access(self, db_names, strict=True):
        
        return self.manager.revoke_user_access(self, db_names, strict=strict)
484887
def admin_delete
      return if !user_is_allowed('products', 'delete')
      ip = ModificationValueInputField.find(params[:id]).destroy      
      render :json => Caboose::StdClass.new({
        :success => true
      })
    end
835640
def revoke_token(token_id, user):
    
    try:
        token = TokenBlacklist.query.filter_by(id=token_id, user_identity=user).one()
        token.revoked = True
        db.session.commit()
    except NoResultFound:
        raise TokenNotFound("Could not find the token {}".format(token_id))
178766
def _is_admin(user_id):
    
    user = get_session().query(User).filter(User.id==user_id).one()

    if user.is_admin():
        return True
    else:
        return False
794052
def revokeTablePermission(self, login, user, table, perm):
    
    self.send_revokeTablePermission(login, user, table, perm)
    self.recv_revokeTablePermission()
734843
def admin_delete
      return if !user_is_allowed('orders', 'delete')
      Order.find(params[:id]).destroy
      render :json => Caboose::StdClass.new({
        :redirect => '/admin/orders'
      })
    end
1235604
def revokeSystemPermission(self, login, user, perm):
    
    self.send_revokeSystemPermission(login, user, perm)
    self.recv_revokeSystemPermission()
1132203
def account_delete(request, username,
        template_name=accounts_settings.ACCOUNTS_PROFILE_DETAIL_TEMPLATE,
        extra_context=None, **kwargs):
    
    user = get_object_or_404(get_user_model(),
                             username__iexact=username)
    user.is_active = False
    user.save()

    return redirect(reverse('accounts_admin'))
248435
def revoke_user_access( self, access_id ):
        '''
            
        ''' 
        path = "/api/v3/publisher/user/access/revoke"

        data = {
            'api_token': self.api_token, 
            'access_id': access_id,
        }

        r = requests.get( self.base_url + path, data=data )

        if r.status_code != 200:
            raise ValueError( path + ":" + r.reason )
1290835
public function isUserAllowedToDeleteOwnAccount()
    {
        $allowUsersToDeleteTheirAccount = Registry::getConfig()->getConfigParam('blAllowUsersToDeleteTheirAccount');

        $user = $this->getUser();

        return $allowUsersToDeleteTheirAccount && $user && !$user->isMallAdmin();
    }
919325
def delete(self, user):
        
        self._check_auth(must_admin=True)
        is_admin = self._check_admin()
        try:
            referer = cherrypy.request.headers['Referer']
        except Exception as e:
            referer = '/'
        self._deleteuser(user)
        self._add_notification('User Deleted')
        raise cherrypy.HTTPRedirect(referer)
1086706
def delete_all_couchdb_admins():
    '''
        
    '''
    # Get current cozy token
    username = get_admin()[0]
    # Get CouchDB admin list
    admins = get_couchdb_admins()

    # Delete all admin user excluding current
    for admin in admins:
        if admin == username:
            print "Delete {} later...".format(admin)
        else:
            print "Delete {}".format(admin)
            delete_couchdb_admin(admin)

    # Delete current CouchDB admin
    admin = username
    print "Delete {}".format(admin)
    delete_couchdb_admin(admin)
166456
def delete(cls, bucket_id):
        
        bucket = cls.get(bucket_id)
        if not bucket or bucket.deleted:
            return False

        bucket.deleted = True
        return True
667011
function revokePermission (commandOptions, { accountId, grantablePermissionName }) {
  return command(
    commandOptions,
    txHelper.addCommand(
      txHelper.emptyTransaction(),
      'revokePermission',
      {
        accountId,
        grantablePermissionName
      }
    )
  )
}
372236
def delete(user_id):
        '''
        
        '''
        try:
            del_count = TabMember.delete().where(TabMember.uid == user_id)
            del_count.execute()
            return True
        except:
            return False
1039923
def revoke_grant(key_id, grant_id, region=None, key=None, keyid=None,
                 profile=None):
    '''
    
    '''
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)

    if key_id.startswith('alias/'):
        key_id = _get_key_id(key_id)
    r = {}
    try:
        conn.revoke_grant(key_id, grant_id)
        r['result'] = True
    except boto.exception.BotoServerError as e:
        r['result'] = False
        r['error'] = __utils__['boto.get_error'](e)
    return r